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

Improve deep clone performance #515

Merged
merged 3 commits into from
Aug 2, 2023

Conversation

louiszawadzki
Copy link
Contributor

What does this PR do?

Improve the performance of the deep clone function that is used for event mappers.

If we need to increase the depth of clones again, we can also look at dropping some keys from the clone: for the actionEventMapper, what takes a lot of cloning time is the actionContext containing a lot of circular references.
Dropping this field from the cloned object would also significantly reduce the impact on performance, but is a bit less straightforward than just decreasing the max object depth.

Motivation

Currently adding an actionEventMapper slows apps down on user interactions: #514

Review checklist (to be filled by reviewers)

  • Feature or bugfix MUST have appropriate tests
  • Make sure you discussed the feature or bugfix with the maintaining team in an Issue
  • Make sure each commit and the PR mention the Issue number (cf the CONTRIBUTING doc)
  • If this PR is auto-generated, please make sure also to manually update the code related to the change

@louiszawadzki louiszawadzki requested a review from a team as a code owner August 1, 2023 14:08
Copy link

@justinadkins justinadkins left a comment

Choose a reason for hiding this comment

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

LGTM, thank your lightning fast response to this @louiszawadzki!

* 7: 40ms
* 6: 15ms
* 5: 4ms
* 4: <1ms

Choose a reason for hiding this comment

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

🔥

@justinadkins
Copy link

I did some sampling in our application and can confirm this resolves the performance hit. deepClone is now running <1ms on average. The largest I saw was 2.75ms.

@louiszawadzki louiszawadzki merged commit 1537737 into develop Aug 2, 2023
3 checks passed
@louiszawadzki louiszawadzki deleted the louiszawadzki/improve-deep-clone-performance branch August 2, 2023 13:15
@louiszawadzki louiszawadzki mentioned this pull request Aug 2, 2023
4 tasks
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 this pull request may close these issues.

3 participants