Deduplicate BitBuffer set-index visitors - #9461
Conversation
Signed-off-by: Connor Tsui <connor.tsui20@gmail.com>
Merging this PR will degrade performance by 10.88%
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| ❌ | Simulation | chunked_canonicalize_into[(1000, 50, 8, 64)] |
15.1 ms | 16.9 ms | -10.88% |
| 🆕 | Simulation | all_valid_exclusive[4096] |
N/A | 482.6 µs | N/A |
| 🆕 | Simulation | all_valid_exclusive[65536] |
N/A | 7.3 ms | N/A |
| 🆕 | Simulation | nullable_exclusive[4096] |
N/A | 358.7 µs | N/A |
| 🆕 | Simulation | nullable_exclusive[65536] |
N/A | 5.2 ms | N/A |
Tip
Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.
Comparing ct/bit-buffer-infallible-visitor (d67c41c) with develop (bf6b2be)2
Footnotes
-
89 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩
-
No successful run was found on
develop(004e512) during the generation of this report, so bf6b2be was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩
|
this came up from #9353 (comment) |
|
This one looks good. Rechecked Direct `for_each_set_index` LLVM IR and assemblyConfiguration:
The final monomorphization comes from CARGO_TARGET_DIR=<separate-parent-or-head-target> \
RUSTC_WRAPPER= \
RUSTFLAGS='-C target-feature=+avx2 -C force-frame-pointers=yes -C remark=loop-vectorize -C debuginfo=line-tables-only' \
cargo rustc -p vortex-mask --bench mask_iteration --profile bench \
--target x86_64-apple-darwin -- --emit=llvm-ir,asm,linkBoth revisions retain the same The complete inventory SHA-256 is The bounded pre-link assembly body has 723 instructions on both revisions and is byte-for-byte identical after removing line-table directives. Its SHA-256 is Reported FSST CodSpeed regressionThe reported case was The optimized benchmark root has the same normalized LLVM IR SHA-256 on both revisions: Its bounded pre-link assembly body has 446 instructions on both revisions and is byte-for-byte identical. The normalized assembly SHA-256 is: CodSpeed also compared against fallback This is compiler-output evidence, not wall-clock evidence. The target matches CodSpeed's x86-64 architecture and AVX2 feature set, but uses the macOS ABI rather than the Linux ABI. |
Rationale for this change
Keeps the infallible and fallible set-index visitors on one implementation. Optimized LLVM IR and assembly for the measured hot path were identical. Eight paired runtime comparisons on macOS with Apple M4 Max and rustc 1.97.1 showed no clear difference.
What changes are included in this PR?
Routes
BitBuffer::for_each_set_indexthroughtry_for_each_set_indexwithInfallible, removing the duplicate traversal. Thevortex-buffertests, all-target/all-feature Clippy, and doctests pass.What APIs are changed? Are there any user-facing changes?
No public API or behavior changes.