Add NEON support for is_ascii and eq_ignore_ascii_case - #160143
Merged
Conversation
Member
|
@bors r+ |
Contributor
Contributor
|
⌛ Testing commit ccbf7c6 with merge 37c88a8... Workflow: https://github.com/rust-lang/rust/actions/runs/30779241503 |
rust-bors Bot
pushed a commit
that referenced
this pull request
Aug 3, 2026
Add NEON support for is_ascii and eq_ignore_ascii_case Results on my aarch64 machine. ## 1. `is_ascii` ### 1.1 Raw Data (ns/iter, case00_libcore only — the path that calls `bytes.is_ascii()`) | Input | Baseline (NEON off) | Optimized (NEON on) | Change | |---|---|---|---| | long | 19.69 | 6.46 | **-67.2%** | | unaligned_both_long | 22.60 | 8.92 | **-60.5%** | | unaligned_head_long | 20.62 | 8.81 | **-57.3%** | | unaligned_tail_long | 21.15 | 8.68 | **-59.0%** | | medium | 3.10 | 2.92 | -5.8% | | short | 3.77 | 3.81 | +1.1% | | unaligned_both_medium | 2.59 | 2.83 | +9.3% | | unaligned_head_medium | 2.95 | 5.00 | +69.5% | | unaligned_tail_medium | 2.37 | 2.96 | +24.9% | ### 1.2 Grouped Comparison (case00_libcore — the path affected by the change) | Group | Baseline sum (ns) | Optimized sum (ns) | Change | |---|---|---|---| | **LONG (~350B, 4 items)** | 84.06 | 32.87 | **-60.9%** | | **MEDIUM/SHORT (~16–32B, 5 items)** | 14.78 | 17.52 | +18.5% | | All 9 items | 98.84 | 50.39 | **-49.0%** | ## 2. `eq_ignore_ascii_case` ### 2.1 Raw Data (ns/iter) | Bench | Baseline (NEON off) | Optimized (NEON on) | Change | |---|---|---|---| | bench_large_str_eq | 6235.89 | 546.61 | **-91.2%** | | bench_medium_str_eq | 780.81 | 68.05 | **-91.3%** | | bench_medium_str_tail_mismatch | 786.84 | 65.76 | **-91.6%** | | bench_str_31_bytes_eq | 35.87 | 3.98 | **-88.9%** | | bench_str_17_bytes_eq | 19.62 | 4.05 | **-79.4%** | | bench_medium_str_early_mismatch | 1.32 | 2.42 | +0.75 ns | | bench_str_of_8_bytes_eq | 9.20 | 9.20 | 0.0% | | bench_str_under_8_bytes_eq | 3.49 | 3.49 | 0.0% | ### 2.2 Grouped Comparison | Group | Scenario | Baseline | Optimized | Change | |---|---|---|---|---| | **≥16B equal** | 17B / 31B / MEDIUM / LARGE | 19.6–6236 ns | 4.0–547 ns | **-79% ~ -91%** | | **≥16B tail mismatch** | MEDIUM, last byte differs | 786.84 ns | 65.76 ns | **-91.6%** | | **≥16B early mismatch** | MEDIUM, first byte differs | 1.32 ns | 2.42 ns | +0.75 ns | | **<16B** | 8B / <8B equal | 3.49–9.20 ns | 3.49–9.20 ns | no change | r? @Amanieu
Member
|
@bors yield (to enclosing rollup) |
Contributor
|
Auto build was cancelled. Cancelled workflows: The next pull request likely to be tested is #160411. |
rust-bors Bot
pushed a commit
that referenced
this pull request
Aug 3, 2026
Rollup of 5 pull requests Successful merges: - #160143 (Add NEON support for is_ascii and eq_ignore_ascii_case) - #160191 (bootstrap: Don't pass `Kind` to some places that don't need it) - #160386 (rustc_data_structures: Cleanup jobserver initialization) - #160409 (Remove redundant target check from check_eii_impl) - #160410 (Update GitHub Actions to v7.0.1)
rust-timer
added a commit
that referenced
this pull request
Aug 3, 2026
Rollup merge of #160143 - ywxt:add-neon-support-is-ascii, r=Amanieu Add NEON support for is_ascii and eq_ignore_ascii_case Results on my aarch64 machine. ## 1. `is_ascii` ### 1.1 Raw Data (ns/iter, case00_libcore only — the path that calls `bytes.is_ascii()`) | Input | Baseline (NEON off) | Optimized (NEON on) | Change | |---|---|---|---| | long | 19.69 | 6.46 | **-67.2%** | | unaligned_both_long | 22.60 | 8.92 | **-60.5%** | | unaligned_head_long | 20.62 | 8.81 | **-57.3%** | | unaligned_tail_long | 21.15 | 8.68 | **-59.0%** | | medium | 3.10 | 2.92 | -5.8% | | short | 3.77 | 3.81 | +1.1% | | unaligned_both_medium | 2.59 | 2.83 | +9.3% | | unaligned_head_medium | 2.95 | 5.00 | +69.5% | | unaligned_tail_medium | 2.37 | 2.96 | +24.9% | ### 1.2 Grouped Comparison (case00_libcore — the path affected by the change) | Group | Baseline sum (ns) | Optimized sum (ns) | Change | |---|---|---|---| | **LONG (~350B, 4 items)** | 84.06 | 32.87 | **-60.9%** | | **MEDIUM/SHORT (~16–32B, 5 items)** | 14.78 | 17.52 | +18.5% | | All 9 items | 98.84 | 50.39 | **-49.0%** | ## 2. `eq_ignore_ascii_case` ### 2.1 Raw Data (ns/iter) | Bench | Baseline (NEON off) | Optimized (NEON on) | Change | |---|---|---|---| | bench_large_str_eq | 6235.89 | 546.61 | **-91.2%** | | bench_medium_str_eq | 780.81 | 68.05 | **-91.3%** | | bench_medium_str_tail_mismatch | 786.84 | 65.76 | **-91.6%** | | bench_str_31_bytes_eq | 35.87 | 3.98 | **-88.9%** | | bench_str_17_bytes_eq | 19.62 | 4.05 | **-79.4%** | | bench_medium_str_early_mismatch | 1.32 | 2.42 | +0.75 ns | | bench_str_of_8_bytes_eq | 9.20 | 9.20 | 0.0% | | bench_str_under_8_bytes_eq | 3.49 | 3.49 | 0.0% | ### 2.2 Grouped Comparison | Group | Scenario | Baseline | Optimized | Change | |---|---|---|---|---| | **≥16B equal** | 17B / 31B / MEDIUM / LARGE | 19.6–6236 ns | 4.0–547 ns | **-79% ~ -91%** | | **≥16B tail mismatch** | MEDIUM, last byte differs | 786.84 ns | 65.76 ns | **-91.6%** | | **≥16B early mismatch** | MEDIUM, first byte differs | 1.32 ns | 2.42 ns | +0.75 ns | | **<16B** | 8B / <8B equal | 3.49–9.20 ns | 3.49–9.20 ns | no change | r? @Amanieu
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.
Results on my aarch64 machine.
1.
is_ascii1.1 Raw Data (ns/iter, case00_libcore only — the path that calls
bytes.is_ascii())1.2 Grouped Comparison (case00_libcore — the path affected by the change)
2.
eq_ignore_ascii_case2.1 Raw Data (ns/iter)
2.2 Grouped Comparison
r? @Amanieu