Merged
Conversation
Access _key_cache directly and inline _cmpkey call in __hash__ instead of going through the _key property. This avoids property descriptor overhead on every hash call, matching the pattern already used by the comparison method overrides.
Member
Author
|
It's fairly mild performance improvement but it's there: |
henryiii
approved these changes
Mar 11, 2026
Contributor
henryiii
left a comment
There was a problem hiding this comment.
Clearly measurable. I wonder if it's true that 3.14 is the fastest - maybe it's optimizing code better and this is more optimizable.
Member
Author
I don't see Python 3.14 as an outlier running the benchmark a few times locally ¯\(ツ)/¯ |
f3d84d4 to
ceff51b
Compare
Contributor
|
Okay, probably just had a good or bad CI run then. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Like all the other methods on Version, it provides a small performance improvement to skip accessing the property. In this case we don't have an
otherto check the instance on.