-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
gh-109868: Skip deepcopy memo check for empty memo #109869
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
Conversation
The difference is equal to one standard deviation. I am not sure that it is not random. |
@serhiy-storchaka Here are some more detailed measurements:
Results (with
The code change itself is very simple. It avoids a dict lookup, assignment to a local variable The performance gain is small, but so is the change and I do not see any downsides to the change. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, the benefit is tiny, but the cost is virtually zero. I think nothing bad will happen if we accept it.
Thank you for your contribution @eendebakpt.
|
In the
copy.deepcopy
method we can skip the initial memo check if the memo was just created.Benchmark: