[perf] faster sparse bitpacked filter & take - #9723
Conversation
Signed-off-by: Will Manning <will@willmanning.io>
Signed-off-by: Will Manning <will@willmanning.io>
Merging this PR will regress 1 benchmark
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| ❌ | Simulation | cold_misaligned[(16, 64)] |
345.8 µs | 389.4 µs | -11.21% |
| ⚡ | WallTime | words_gather_scalar_avx2[65536] |
9.4 µs | 8.3 µs | +13.22% |
| ⚡ | WallTime | mul_u32_nonnull_avx512 |
6.3 µs | 5.8 µs | +10.23% |
| ⚡ | Simulation | take_10_contiguous |
52.4 µs | 47.5 µs | +10.12% |
| 🆕 | WallTime | filter_neon[32] |
N/A | 1.7 µs | N/A |
| 🆕 | WallTime | filter_neon[48] |
N/A | 2.1 µs | N/A |
| 🆕 | WallTime | filter_neon[8] |
N/A | 1.2 µs | N/A |
| 🆕 | WallTime | filter_neon[32] |
N/A | 2 µs | N/A |
| 🆕 | WallTime | filter_neon[48] |
N/A | 2.4 µs | N/A |
| 🆕 | WallTime | filter_neon[8] |
N/A | 1.3 µs | N/A |
| 🆕 | WallTime | filter_neon[32] |
N/A | 1.7 µs | N/A |
| 🆕 | WallTime | filter_neon[48] |
N/A | 2.1 µs | N/A |
| 🆕 | WallTime | filter_neon[8] |
N/A | 1.2 µs | N/A |
| 🆕 | WallTime | filter_neon[64] |
N/A | 2.3 µs | N/A |
| 🆕 | WallTime | filter_neon[8] |
N/A | 1.2 µs | N/A |
| 🆕 | WallTime | filter_neon[80] |
N/A | 3 µs | N/A |
| 🆕 | WallTime | filter_neon[96] |
N/A | 3.2 µs | N/A |
| 🆕 | WallTime | filter_neon[64] |
N/A | 2.5 µs | N/A |
| 🆕 | WallTime | filter_neon[8] |
N/A | 1.2 µs | N/A |
| 🆕 | WallTime | filter_neon[80] |
N/A | 3.4 µs | N/A |
| ... | ... | ... | ... | ... | ... |
ℹ️ Only the first 20 benchmarks are displayed. Go to the app to view all benchmarks.
Tip
Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.
Comparing wm/fastlanes-sparse-extraction (9f1f51e) with develop (50cd6d7)
Footnotes
-
206 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. ↩
-
4 benchmarks were run, but are now archived. If they were deleted in another branch, consider rebasing to remove them from the report. Instead if they were added back, click here to restore them. ↩
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Summary
Why
The old sparse paths called
unpack_singleonce for each selected value. Each call repeated dispatch and setup work.FastLanes 0.7.1 adds
unpack_indices. It extracts an index batch with one dispatch.The local crossover limits are 16, 32, 64, and 160 values for
u8,u16,u32, andu64.These limits match the conservative FastLanes policy. Local Apple M1 tests supported the same limits or larger limits.
Benchmarks
I ran the benchmarks in release mode on an Apple M1. The baseline uses the old Vortex code with FastLanes 0.7.1.
Each case selects eight values from each of eight chunks. The array contains 64 chunks, which avoids the outer full-decode policies.
The table shows the median improvement range across three packed bit widths.
u8u16u32u64The benchmarks also cover each crossover limit and values above each limit.
Verification
cargo test -p vortex-fastlanescargo clippy -p vortex-fastlanes --all-targets --all-features -- -D warningscargo clippy --all-targets --all-features -- -D warningscargo bench -p vortex-fastlanes --bench bitpacking_filter -- thresholdcargo bench -p vortex-fastlanes --bench bitpacking_take -- threshold