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

CollectionTransformer performance #7

Merged
merged 1 commit into from
Jun 20, 2022

Conversation

kontoulis
Copy link
Contributor

@kontoulis kontoulis commented Jun 14, 2022

Description
Resolves the performance issue #1.

After debugging and measuring execution times in several scenarios, it turns out that the performance issue is related to the number of translations passed to ModelTransformer@applyTranslations.
For example if we have a collection of 1000 objects to be translated and each one of them has 5 translated properties,
ModelTransformer@applyTranslations has to loop over these 5000 translations for every one of those 1000 objects.
This gets even worse when we perform deep translation.

Solution
Passing only the required translations to ModelTransformer@applyTranslations resolves this issue.
Required translations are the model translations and the relations translations if we have to perform deep translation.

@kontoulis kontoulis added the bug label Jun 14, 2022
@kontoulis kontoulis requested a review from kirkbushell June 14, 2022 09:42
@tectonic tectonic deleted a comment from kontoulis Jun 20, 2022
Copy link
Member

@kirkbushell kirkbushell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks good, but there's no tests, and there's a substantial amount of logic and complexity in the request.

@kontoulis
Copy link
Contributor Author

kontoulis commented Jun 20, 2022

@kirkbushell I have changed only implementation details and the functionality is already covered in EndToEndTest. I am not sure what else to test.

Edit: It actually ended up with some complexity in order to pass the tests, as when I started it I didn't consider all the use cases. This was basically TDD, just with existing tests :P

@kirkbushell kirkbushell merged commit e328652 into master Jun 20, 2022
@kirkbushell kirkbushell deleted the bugfix/collection-transformer-slowness branch June 20, 2022 10:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants