Skip to content

Benchmark canonicalizing a dictionary over sparse codes - #11698

Open
gatesn wants to merge 1 commit into
developfrom
ngates/sparse-dict-codes-bench
Open

gatesn wants to merge 1 commit into
developfrom
ngates/sparse-dict-codes-bench

Conversation

@gatesn

@gatesn gatesn commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Adds encodings/sparse/benches/sparse_dict_codes.rs, which canonicalizes Dict(Sparse(positions, codes, NULL), values) over 65,536 rows with a 1,000-entry dictionary. It covers two value types (i64 and UTF-8) at two patch densities: one present row in 100, and one in 10. The array is built unoptimized, as a reader produces it, so the measurement includes whatever path execution picks for combining the dictionary with its sparse codes. This is the shape a dictionary-encoded column takes when most of its rows are null, and #11174 optimizes exactly this path. The benchmark lands separately so that CodSpeed has a baseline for #11174.

For review: the sparse codes are nullable u16, matching the null fill. The bench count in scripts/codspeed_bench_counts.json is 4, one per (value type, density) case.

CodSpeed reports the four benchmarks as new. Its one other change, bitpack_compare_sweep::compare[1], is in a crate this PR does not touch.

benchmark CodSpeed (CPU simulation)
canonicalize_dict_sparse_codes_primitive[100] 1,007 µs
canonicalize_dict_sparse_codes_primitive[10] 1.3 ms
canonicalize_dict_sparse_codes_utf8[100] 3.1 ms
canonicalize_dict_sparse_codes_utf8[10] 3.3 ms

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Nicholas Gates <nick@nickgates.com>
@gatesn gatesn added the changelog/chore A trivial change label Nov 20, 2026
@codspeed

codspeed Bot commented Nov 20, 2026

Copy link
Copy Markdown

Merging this PR will improve performance by 20.86%

1 warning

⚠️ Walltime results may be unreliable

Some benchmarks used the Walltime instrument outside CodSpeed Macro Runners, which can make the results inconsistent.

Learn more about Macro Runners

See affected benchmarks

⚡ 1 improved benchmark
✅ 1981 untouched benchmarks
🆕 4 new benchmarks
⏩ 58 skipped benchmarks1

Performance Changes

Mode Benchmark BASE HEAD Efficiency
⚡ CPU Simulation compare[1] 57.5 µs 47.6 µs +20.86%
🆕 CPU Simulation canonicalize_dict_sparse_codes_primitive[10] N/A 1.3 ms N/A
🆕 CPU Simulation canonicalize_dict_sparse_codes_primitive[100] N/A 1 ms N/A
🆕 CPU Simulation canonicalize_dict_sparse_codes_utf8[10] N/A 3.3 ms N/A
🆕 CPU Simulation canonicalize_dict_sparse_codes_utf8[100] N/A 3.1 ms N/A

Tip

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


Comparing ngates/sparse-dict-codes-bench (e5a7fc9) with develop (7591044)

Open in CodSpeed

Footnotes

  1. 58 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. ↩

This branch has not been deployed

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

Labels

changelog/chore A trivial change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant