Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minimize same getter calls #346

Open
porunov opened this issue Apr 24, 2020 · 0 comments · May be fixed by #347
Open

Minimize same getter calls #346

porunov opened this issue Apr 24, 2020 · 0 comments · May be fixed by #347

Comments

@porunov
Copy link

porunov commented Apr 24, 2020

During mapping we call getters multiple times. For different situations I see different amount of getter calls (2-5 calls for a single field).
I case our getter has slow computation (for example, database calls, or generally complex logic) it may cause additional delays which could be omitted if we would call a getter only once.
Other possible problem which could be is unnecessary or unpredicted computation (for example, if we change something between each call of the getter method).
To mitigate this issue I would propose minimize getter calls (ideally we should call a getter only once, if it is needed).
A possible solution, could be making a variables for each mapping field of source object and destination object (optionally). After that we could use created variables instead of calling getters to retrieve the value.

porunov added a commit to porunov/orika that referenced this issue Apr 24, 2020
Related to orika-mapper#346

Signed-off-by: Oleksandr Porunov <alexandr.porunov@gmail.com>
@porunov porunov linked a pull request Apr 24, 2020 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant