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(clone): avoid further unnecessary checks if cloning a primitive value #14762

Merged
merged 1 commit into from
Jul 26, 2024

Conversation

vkarpov15
Copy link
Collaborator

Summary

Looking more closely at #14394, we actually call clone() on primitive values a lot in Mongoose. cloneObject(), for instance, calls clone() on every key.

This PR is looking like another maybe 10% speedup on recursiveToObject benchmark, 308ms average vs 345ms average.

Examples

@vkarpov15 vkarpov15 added this to the 8.5.2 milestone Jul 23, 2024
@vkarpov15 vkarpov15 merged commit f921c9a into master Jul 26, 2024
45 of 46 checks passed
@hasezoey hasezoey deleted the vkarpov15/perf-clone-primitives branch July 27, 2024 09:34
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.

2 participants