Merged
Conversation
Signed-off-by: Henry Schreiner <henryfs@princeton.edu>
Signed-off-by: Henry Schreiner <henryfs@princeton.edu>
Signed-off-by: Henry Schreiner <henryfs@princeton.edu>
brettcannon
approved these changes
Jan 14, 2026
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.
This is faster than the current version, and a bit simpler. Suggested by ℤahlman on discord a while back; I thought it would be slower so I didn't try it till now. I found a way to improve it to be faster, actually, and more like the previous version but inline. I had the function primarily for the early return, but this avoids that, making it faster I think in the common case where a zero does not need to be stripped, due to the removed function call.
It also removes the function added in 26.0
_strip_trailing_zeros, which is why it might be worth putting in now, to keep people from depending on that (private) function? I'm perfectly fine to leave it till after 26.0 final, though, since we are in RC phase. Not that anyone would depend on something with a leading underscore. What do other people think? It's about 10% faster hashing and 5% faster sorting.Edit: found a problem in the asv benchmarks;
.setupis not rerun between samples, so caching needs to be cleared. Fixing this shows this is a bit faster.All benchmarks: