Repository navigation
gh-120196: Faster ascii_decode and find_max_char implementations #120212
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
Closed
Closed
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
a54bf86
Write an unrolled version of find_max_char
rhpvorderman 71ff457
Unroll 8 characters rather than 4 to improve vectorization in find_ma…
rhpvorderman 98a6449
Bigger chunk ascii decoding
rhpvorderman 10527c6
Fix whitespace issues
rhpvorderman f0f4139
Fix compiler warnings
rhpvorderman 849a068
Prevent re-read of same value
rhpvorderman fad19a0
Simplify find_max_char initialization
rhpvorderman f04bb2c
Add missing increments
rhpvorderman cd0fc5e
Add blurb
rhpvorderman 8f0fd56
Replace unroll_end with unrolled_end
rhpvorderman 37aee7a
Reword burb
rhpvorderman a6fc417
Update Objects/stringlib/find_max_char.h
rhpvorderman 104ca62
Merge branch 'main' into MICROOPTIMIZATIONS
rhpvorderman d465517
Merge branch 'main' into MICROOPTIMIZATIONS
rhpvorderman 1ce308e
Reuse find_max_char for bytes objects
rhpvorderman 48f1e84
Simplify the find_max_char function by loading unaligned
rhpvorderman 21de804
Allow optimized unaligned loads and simplify ascii_decode
rhpvorderman 1ec2113
Add loop for more optimal assembly
rhpvorderman 0258ae0
Also perform an unalgined load at the end
rhpvorderman ec76b74
Fix compiler warning
rhpvorderman 845eb4e
Revert "Reuse find_max_char for bytes objects"
rhpvorderman f8cc68d
Merge branch 'main' into MICROOPTIMIZATIONS
rhpvorderman 89ab2c9
Improve comments
rhpvorderman 002b7ec
Merge branch 'main' into MICROOPTIMIZATIONS
rhpvorderman File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Simplify find_max_char initialization
- Loading branch information
commit fad19a046fcbf071d39b57c56b81b89ee04355e8
There are no files selected for viewing
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
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.
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.
Just checking whether I understand correctly:
aligned_endis not aligned, but good enough to serve as the end of the loop over aligned values. To make it really aligned we would need to do something likealigned_end = _Py_SIZE_ROUND_DOWN(_end, SIZEOF_SIZE_T)?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.
Yes that is the gist of it. I tried something similar to _Py_SIZE_ROUND_DOWN and got segfaults so I opted for this simpler tried and true solution. The name
aligned_endis probably not the best, but I can't think of a better name now.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.
Should be something like
Would be interested in understanding why you got a segfault though.