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

Perf improvements when creating arrays of primitives #14120

Merged
merged 5 commits into from
Nov 27, 2023
Merged

Conversation

vkarpov15
Copy link
Collaborator

Summary

Re: #11380, #13546. This one quick improvement of using push() instead of concat() already helps shave off maybe 10% off of #11380.

Before:

l100.avg=1140.53, total.avg=3175.7342

After:

l100.avg=1249.86, total.avg=2870.4085

Gonna work to see what other performance wins we can turn up.

Examples

@vkarpov15
Copy link
Collaborator Author

With 7d26ad2 we've managed to shave off a total of 40%:

l100.avg=1117, total.avg=1898.9985

vs latest 7.x:

l100.avg=1116.11, total.avg=3078.2941

Mongoose 7.x is now significantly faster (about 35%) than latest Mongoose 4 at pushing elements onto an array:

l100.avg=492.34, total.avg=2761.561

@vkarpov15
Copy link
Collaborator Author

New flamegraph:

image

Copy link
Collaborator

@hasezoey hasezoey left a comment

Choose a reason for hiding this comment

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

Looks good to me, but i am not quite sure what actually changed or performance characteristics (it seems like setters are called less?)

lib/types/array/methods/index.js Show resolved Hide resolved
@vkarpov15 vkarpov15 merged commit 8b285a1 into 7.x Nov 27, 2023
42 checks passed
@hasezoey hasezoey deleted the vkarpov15/gh-11380 branch November 27, 2023 16:37
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.

None yet

2 participants