Skip to content

[perf] faster sparse bitpacked filter & take - #9723

Open
lwwmanning wants to merge 2 commits into
rk/fastlanes-sparse-benchmarksfrom
wm/fastlanes-sparse-extraction
Open

lwwmanning wants to merge 2 commits into
rk/fastlanes-sparse-benchmarksfrom
wm/fastlanes-sparse-extraction

Conversation

@lwwmanning

@lwwmanning lwwmanning commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Summary

  • This PR updates FastLanes from 0.7.0 to 0.7.1.
  • Sparse filter and take paths now extract each index batch with one FastLanes call.
  • Larger requests still decode a complete 1,024-value block.
  • Existing whole-array decode policies remain unchanged.
  • Builds on the sparse filter and take benchmarks in [bench] sparse bitpacked filter and take #9900.

Why

The old sparse paths called unpack_single once 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, and u64.

These limits match the conservative FastLanes policy. Local Apple M1 tests supported the same limits or larger limits.

Benchmarks

The previously reported measurements used release mode on an Apple M1 and three packed bit widths per type. The retained benchmark matrix in #9900 uses the middle width for each type. 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.

Type Filter Take
u8 17-23% 15-19%
u16 17% 27-34%
u32 15-18% 46-50%
u64 13-18% 65-67%

The benchmarks also cover each crossover limit and values above each limit.

Verification

The following checks were reported before this PR was split. Tests and benchmarks were not rerun for the split; the combined stack preserves the original tree exactly.

  • cargo test -p vortex-fastlanes
  • cargo clippy -p vortex-fastlanes --all-targets --all-features -- -D warnings
  • cargo clippy --all-targets --all-features -- -D warnings
  • cargo bench -p vortex-fastlanes --bench bitpacking_filter -- threshold
  • cargo bench -p vortex-fastlanes --bench bitpacking_take -- threshold

@lwwmanning lwwmanning changed the title perf(fastlanes): Batch sparse bit-packed extraction [perf] faster sparse bitpacked filter & take Sep 1, 2026
@codspeed

codspeed Bot commented Sep 1, 2026

Copy link
Copy Markdown

Merging this PR will improve performance by 36.9%

⚠️ Unknown Walltime execution environment detected

Using the Walltime instrument on standard Hosted Runners will lead to inconsistent data.

For the most accurate results, we recommend using CodSpeed Macro Runners: bare-metal machines fine-tuned for performance measurement consistency.

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

⚡ 28 improved benchmarks
✅ 2246 untouched benchmarks
⏩ 218 skipped benchmarks1

Performance Changes

Mode Benchmark BASE HEAD Efficiency
WallTime threshold_neon[8] 4.6 µs 1.7 µs ×2.7
WallTime threshold_avx2[8] 3.4 µs 1.7 µs +94.7%
WallTime threshold_neon[8] 3.2 µs 1.8 µs +79.55%
WallTime threshold_neon[160] 8.5 µs 4.9 µs +71.94%
WallTime threshold_avx512[8] 3 µs 1.8 µs +70.39%
WallTime threshold_neon[64] 4.7 µs 2.9 µs +63.39%
WallTime threshold_avx2[8] 2.5 µs 1.7 µs +44.48%
WallTime threshold_avx2[160] 6.3 µs 4.6 µs +37.63%
WallTime threshold_avx512[192] 6.5 µs 4.7 µs +36.6%
WallTime threshold_avx512[160] 5.9 µs 4.4 µs +34.06%
WallTime threshold_avx512[8] 2.3 µs 1.7 µs +33.28%
WallTime filter_neon[64] 3.2 µs 2.4 µs +31.21%
WallTime threshold_neon[192] 9.2 µs 7.1 µs +30.43%
WallTime threshold_neon[32] 2.9 µs 2.3 µs +28.18%
WallTime threshold_neon[8] 2.2 µs 1.7 µs +27.7%
WallTime threshold_avx2[192] 7 µs 5.5 µs +27.15%
WallTime filter_neon[160] 5.7 µs 4.5 µs +26.45%
WallTime threshold_neon[80] 5.1 µs 4.1 µs +24.08%
WallTime threshold_avx2[80] 3.9 µs 3.1 µs +23.73%
WallTime threshold_avx512[64] 3.3 µs 2.7 µs +22.82%
... ... ... ... ... ...

ℹ️ Only the first 20 benchmarks are displayed. Go to the app to view all benchmarks.

Tip

Curious why performance improved? Comment @codspeedbot explain why performance improved on this PR, or directly use the CodSpeed MCP with your agent.


Comparing wm/fastlanes-sparse-extraction (895c184) with rk/fastlanes-sparse-benchmarks (f17daff)

Open in CodSpeed

Footnotes

  1. 218 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.

@lwwmanning lwwmanning added the changelog/performance A performance improvement label Sep 1, 2026
@lwwmanning
lwwmanning marked this pull request as ready for review September 1, 2026 22:44
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 1, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-01T22:47:10.916657Z 9f1f51e Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

Copy link
Copy Markdown
Contributor

This PR has been marked as stale because it has been open for 14 days with no activity. Please comment or remove the stale label if you wish to keep it active, otherwise it will be closed in 7 days

@github-actions github-actions Bot added the stale This PR is stale and will be auto-closed soon label Sep 16, 2026
@robert3005
robert3005 force-pushed the wm/fastlanes-sparse-extraction branch 2 times, most recently from 1799391 to ba3a6e2 Compare September 16, 2026 02:18
@robert3005

Copy link
Copy Markdown
Contributor

I have rebased this and reduced some of the benchmarks. Let's merge benchmarks first and then improvements. Hard to judge impact. FWIW even with #9721 there's still an improvement here but it's smaller

Signed-off-by: Will Manning <will@willmanning.io>
Signed-off-by: "Robert Kruszewski" <github@robertk.io>
Signed-off-by: Will Manning <will@willmanning.io>
Signed-off-by: "Robert Kruszewski" <github@robertk.io>
@robert3005
robert3005 changed the base branch from develop to rk/fastlanes-sparse-benchmarks September 16, 2026 02:46
@robert3005
robert3005 force-pushed the wm/fastlanes-sparse-extraction branch from ba3a6e2 to 895c184 Compare September 16, 2026 02:46
@robert3005
robert3005 added this pull request to stack #9901 September 16, 2026 02:46
@robert3005

Copy link
Copy Markdown
Contributor

I made #9900 that this is rebased on, I wanted to see impact of #9721 independently of these changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog/performance A performance improvement stale This PR is stale and will be auto-closed soon

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants