-
-
Notifications
You must be signed in to change notification settings - Fork 34.1k
gh-144015: Add portable SIMD optimization for bytes.hex() #143991
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
Merged
+256
−6
Merged
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
bbb4a8a
pystrhex: Add AVX2 SIMD optimization for hex conversion
gpshead 90da084
pystrhex: Add AVX-512 SIMD optimization for hex conversion
gpshead bdceb9c
pystrhex: Add ARM NEON SIMD optimization for hex conversion
gpshead 4f3d60d
pystrhex: Add SSE2 SIMD optimization for hex conversion
gpshead 015cc55
pystrhex: Remove AVX2/AVX-512, keep SSE2-only for simplicity
gpshead ae3d7be
pystrhex: Replace SSE2/NEON with portable SIMD using GCC vector exten…
gpshead a22e5ce
pystrhex: Add SIMD optimization for large separator groups
gpshead 2fe987c
measure more
gpshead e643fb8
pystrhex: Lower SIMD separator threshold to 8 bytes
gpshead 92c281d
pystrhex: Use signed comparison for efficient SIMD codegen
gpshead 190936f
pystrhex: Factor out scalar hexlify into shared inline function
gpshead b2dd34e
remove benchmark data
gpshead b6feaba
pystrhex: Enable SIMD on 32-bit ARM with NEON
gpshead 0f94c06
explain more in the comments
gpshead e8650f3
remove the microbenchmark code
gpshead 5fc294c
test_bytes: Add SIMD-specific test cases for bytes.hex()
gpshead 2a378d4
pystrhex: Remove SIMD path for separator groups
gpshead 8110537
pystrhex: Use configure.ac detection for SIMD support
gpshead 597c675
NEWS entry
gpshead dfc295f
remove unnecessary info from the code comment
gpshead 37d01ca
Rename HAVE_BUILTIN_SHUFFLEVECTOR to HAVE_EFFICIENT_BUILTIN_SHUFFLEVE…
gpshead 325deb6
Merge branch 'main' into opt-pystrhex
gpshead 9b27e02
reword news, mention hashlib hexdigest
gpshead 348a2f8
aww, goodbye cute "brrr..." comment
gpshead 7e67993
rename the autoconf ac_ function to be consistent
gpshead 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
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
5 changes: 5 additions & 0 deletions
5
....d/next/Core_and_Builtins/2026-02-22-20-15-00.gh-issue-144015.pystrhex_simd.rst
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| Speed up :meth:`bytes.hex`, :meth:`bytearray.hex`, :func:`binascii.hexlify`, | ||
| and :mod:`hashlib` ``.hexdigest()`` operations with SIMD on x86-64, ARM64, | ||
| and ARM32 with NEON when built with gcc (version 12 or higher) or clang | ||
| (version 3 or higher) compilers. Around 1.1-3x faster for common 16-64 byte | ||
| inputs such as hashlib hex digests, and up to 8x faster for larger data. |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.