Skip to content

perf: vectorize small u8 table take with NEON - #9571

Open
joseph-isaacs wants to merge 1 commit into
ji/small-u8-table-take-benchmarkfrom
ji/small-u8-table-take-neon
Open

perf: vectorize small u8 table take with NEON#9571
joseph-isaacs wants to merge 1 commit into
ji/small-u8-table-take-benchmarkfrom
ji/small-u8-table-take-neon

Conversation

@joseph-isaacs

Copy link
Copy Markdown
Contributor

Rationale

Low-cardinality dictionaries with u8 codes and one-byte values can decode through an in-register NEON table instead of arbitrary scalar lookups.

Stacked on benchmark baseline #9566. The x86 implementation is intentionally split into the next PR.

Changes

  • Use NEON TBL on little-endian AArch64.
  • Apply the path to u8 codes, at most 16 one-byte values, and at least 64 rows.
  • Retain bounds checks and the existing fallback.
  • Add correctness and out-of-bounds tests.

CodSpeed wall-time results

Medians over 1,000 samples on Graviton3 metal, compared with #9566:

Rows Baseline NEON Speedup Time reduction
1M 552.4 µs 51.06 µs 10.82× 90.8%
16M 8.786 ms 799.7 µs 10.99× 90.9%

Runs: baseline, optimized.

Checks

  • focused small-table correctness and bounds tests
  • targeted Clippy with warnings denied
  • cargo +nightly fmt --all --check
  • git diff --check

Use NEON TBL for u8-coded tables with at most 16 one-byte values.

Signed-off-by: Joseph Isaacs <joseph-isaacs@users.noreply.github.com>
@codspeed-hq

codspeed-hq Bot commented Aug 24, 2026

Copy link
Copy Markdown

Merging this PR will regress 1 benchmark

⚠️ 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

⚡ 2 improved benchmarks
❌ 1 regressed benchmark
✅ 1984 untouched benchmarks
⏩ 54 skipped benchmarks1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
Simulation compact[(2048, 90)] 1.6 µs 1.8 µs -10.77%
WallTime dict_canonicalize_gt_u8_neon[16000000] 8,736.5 µs 778.6 µs ×11
WallTime dict_canonicalize_gt_u8_neon[1000000] 546.5 µs 50.4 µs ×11

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing ji/small-u8-table-take-neon (21fa748) with ji/small-u8-table-take-benchmark (d49393c)

Open in CodSpeed

Footnotes

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

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant