Skip to content

Conversation

vkarpov15
Copy link
Collaborator

Summary

Re: #14394, we can get a maybe 2.5% speedup by not combining Mongoose global options and schema base options every time we call $toObject(). Not a huge speedup, but every little bit helps given that $toObject() is called on some heavily used code paths, like save() and JSON.stringify().

I'll put this change in 8.5, just to de-risk because it may cause some issues for people who modify toJSON and toObject options after compiling their schemas.

Examples

@vkarpov15 vkarpov15 added this to the 8.5 milestone Jun 17, 2024
@vkarpov15 vkarpov15 changed the base branch from master to 8.5 June 18, 2024 15:10
@vkarpov15 vkarpov15 merged commit 0502d2b into 8.5 Jun 18, 2024
@hasezoey hasezoey deleted the vkarpov15/gh-14394-memoize-defaultoptions branch June 18, 2024 18:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants