Speed up ARM fixed-width array scans - #54
Merged
Merged
Conversation
Add NEON cross-record scanners for 16- and 32-byte records, expand semantic and benchmark coverage, and retune the parallel crossover based on three-run measurements. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 01071e57-12fd-4f42-bc67-e2b274d0b007
📊 Benchmark Comparison Results
➖ 62 benchmarks within noise (click to expand)
Legend: ✅ Faster (>5%) · |
Owner
Author
Python/PyO3 overhead contextThe M4 Max measurements indicate that tiny operations have largely reached the Python/PyO3 call-overhead floor, approximately 30–40 ns per call. This includes Python dispatch, buffer extraction, and result construction.
The fixed wrapper cost dominates tiny and immediate-match calls, but becomes negligible for complete scans and larger inputs. Further meaningful Python-side improvements would likely require batching more work per call or changing the API shape rather than continuing to optimize the per-record Rust kernels. |
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.
What
Adds ARM NEON cross-record scanners for 16- and 32-byte array elements used by the
first,best, andallAPIs. The optimized scanners preserve first-index ordering, lowest-index best ties, threshold behavior, exact-match termination, and ordered results.The Rayon crossover for these widths moves from 5 MiB to 16 MiB because the faster serial scanner makes parallel scheduling beneficial later. Benchmark and randomized semantic coverage are expanded for fixed-width workloads.
Closes the ARM/cross-record portion of #51.
Performance
Three runs per revision on the same Apple M4 Max, comparing median run medians:
Testing
cargo test --no-default-features— 76 unit and 2 doc testspython3 -m pytest -vls .— 187 testscargo fmt --checkruff format --check .ruff check .continues to report the pre-existingEXE001warning fortest/test_hexhamming.py.