perf: align buffer to Alignment::DEFAULT_ALIGNMENT = Alignment::new(256) - #8490
Conversation
Polar Signals Profiling ResultsLatest Run
Previous Runs (3)
Powered by Polar Signals Cloud |
Benchmarks: CompressionVortex (geomean): 0.933x ➖ How to read Verdict and Engines
unknown / unknown (0.937x ➖, 18↑ 0↓)
|
Merging this PR will not alter performance
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| ❌ | Simulation | varbinview_large |
130.2 µs | 392.3 µs | -66.8% |
| ❌ | Simulation | baseline_eq[4, 65536] |
185.2 µs | 243.6 µs | -23.96% |
| ❌ | Simulation | take_10k_random |
196.1 µs | 254.1 µs | -22.85% |
| ❌ | Simulation | baseline_lt[4, 65536] |
200.5 µs | 258.6 µs | -22.48% |
| ❌ | Simulation | take_10k_contiguous |
217.6 µs | 275.2 µs | -20.96% |
| ❌ | Simulation | patched_take_10k_contiguous_patches |
230.1 µs | 289.1 µs | -20.4% |
| ❌ | Simulation | baseline_eq[16, 65536] |
230.1 µs | 288.4 µs | -20.19% |
| ❌ | Simulation | patched_take_10k_random |
242.8 µs | 301.5 µs | -19.47% |
| ❌ | Simulation | baseline_lt[16, 65536] |
245.2 µs | 303.5 µs | -19.21% |
| ❌ | Simulation | chunked_varbinview_canonical_into[(1000, 10)] |
154.8 µs | 190.9 µs | -18.92% |
| ❌ | Simulation | from_iter_bit_buffer[128] |
4.2 µs | 5.1 µs | -17.59% |
| ❌ | Simulation | chunked_varbinview_into_canonical[(1000, 10)] |
169.8 µs | 205.9 µs | -17.53% |
| ❌ | Simulation | decompress_rd[f64, (100000, 0.1)] |
886.5 µs | 1,020.1 µs | -13.09% |
| ❌ | Simulation | true_count_arrow_buffer[128] |
784.7 ns | 872.2 ns | -10.03% |
| ⚡ | Simulation | chunked_bool_canonical_into[(1000, 10)] |
30.7 µs | 16.3 µs | +88.68% |
| ⚡ | Simulation | bitwise_not_vortex_buffer_mut[128] |
273.6 ns | 215.3 ns | +27.1% |
| ⚡ | Simulation | runend_compress_u32 |
4.8 ms | 3.8 ms | +24.36% |
| ⚡ | Simulation | bitwise_not_vortex_buffer_mut[2048] |
456.9 ns | 369.4 ns | +23.68% |
| ⚡ | Simulation | chunked_varbinview_opt_canonical_into[(1000, 10)] |
206.7 µs | 169.6 µs | +21.88% |
| ⚡ | Simulation | bitwise_not_vortex_buffer_mut[1024] |
333.9 ns | 275.6 ns | +21.17% |
| ... | ... | ... | ... | ... | ... |
ℹ️ 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 ji/over-align-buffer-default (06c25e9) with develop (20363bc)
Benchmarks: Appian on NVMEVerdict: No clear signal (low confidence) How to read Verdict and Engines
datafusion / vortex-file-compressed (0.999x ➖, 0↑ 0↓)
datafusion / parquet (1.018x ➖, 0↑ 0↓)
duckdb / vortex-file-compressed (0.996x ➖, 0↑ 0↓)
duckdb / parquet (0.995x ➖, 0↑ 0↓)
duckdb / duckdb (1.029x ➖, 0↑ 0↓)
File Size Changes (19 files changed, -0.0% overall, 17↑ 2↓)
Totals:
|
Benchmarks: TPC-H SF=10 on S3Verdict: No clear signal (environment too noisy confidence) How to read Verdict and Engines
datafusion / vortex-file-compressed (0.976x ➖, 0↑ 0↓)
datafusion / vortex-compact (1.062x ➖, 0↑ 2↓)
datafusion / parquet (1.076x ➖, 0↑ 2↓)
duckdb / vortex-file-compressed (1.030x ➖, 0↑ 1↓)
duckdb / vortex-compact (1.122x ➖, 0↑ 1↓)
duckdb / parquet (0.999x ➖, 0↑ 0↓)
|
Benchmarks: TPC-H SF=1 on S3Verdict: No clear signal (environment too noisy confidence) How to read Verdict and Engines
datafusion / vortex-file-compressed (1.022x ➖, 0↑ 1↓)
datafusion / vortex-compact (1.100x ➖, 0↑ 2↓)
datafusion / parquet (1.071x ➖, 1↑ 1↓)
duckdb / vortex-file-compressed (0.997x ➖, 0↑ 1↓)
duckdb / vortex-compact (1.034x ➖, 0↑ 0↓)
duckdb / parquet (0.995x ➖, 0↑ 0↓)
|
Benchmarks: TPC-H SF=10 on NVMEVerdict: No clear signal (low confidence) How to read Verdict and Engines
datafusion / vortex-file-compressed (0.941x ➖, 2↑ 0↓)
datafusion / vortex-compact (0.948x ➖, 0↑ 0↓)
datafusion / parquet (0.949x ➖, 1↑ 0↓)
datafusion / arrow (0.936x ➖, 2↑ 1↓)
duckdb / vortex-file-compressed (0.965x ➖, 0↑ 0↓)
duckdb / vortex-compact (0.963x ➖, 0↑ 0↓)
duckdb / parquet (0.981x ➖, 1↑ 0↓)
duckdb / duckdb (0.977x ➖, 0↑ 0↓)
File Size Changes (48 files changed, +0.0% overall, 34↑ 14↓)
Totals:
|
Benchmarks: TPC-DS SF=1 on NVMEVerdict: No clear signal (low confidence) How to read Verdict and Engines
datafusion / vortex-file-compressed (0.963x ➖, 3↑ 1↓)
datafusion / vortex-compact (0.967x ➖, 6↑ 3↓)
datafusion / parquet (0.962x ➖, 5↑ 0↓)
duckdb / vortex-file-compressed (0.978x ➖, 4↑ 1↓)
duckdb / vortex-compact (0.977x ➖, 4↑ 0↓)
duckdb / parquet (0.979x ➖, 4↑ 0↓)
duckdb / duckdb (0.988x ➖, 3↑ 0↓)
File Size Changes (48 files changed, -0.0% overall, 41↑ 7↓)
Totals:
|
Benchmarks: Clickbench on NVMEVerdict: No clear signal (low confidence) How to read Verdict and Engines
datafusion / vortex-file-compressed (0.989x ➖, 2↑ 2↓)
datafusion / parquet (1.005x ➖, 1↑ 0↓)
duckdb / vortex-file-compressed (0.984x ➖, 2↑ 1↓)
duckdb / parquet (1.000x ➖, 0↑ 1↓)
duckdb / duckdb (1.007x ➖, 0↑ 1↓)
File Size Changes (201 files changed, +0.0% overall, 164↑ 37↓)
Totals:
|
Benchmarks: PolarSignals ProfilingVortex (geomean): 0.983x ➖ How to read Verdict and Engines
datafusion / vortex-file-compressed (0.983x ➖, 0↑ 2↓)
File Size Changes (1 files changed, -0.0% overall, 0↑ 1↓)
Totals:
|
Benchmarks: TPC-H SF=1 on NVMEVerdict: No clear signal (low confidence) How to read Verdict and Engines
datafusion / vortex-file-compressed (1.033x ➖, 0↑ 0↓)
datafusion / vortex-compact (1.031x ➖, 0↑ 0↓)
datafusion / parquet (1.025x ➖, 0↑ 0↓)
datafusion / arrow (1.067x ➖, 0↑ 7↓)
duckdb / vortex-file-compressed (1.025x ➖, 0↑ 0↓)
duckdb / vortex-compact (1.042x ➖, 0↑ 0↓)
duckdb / parquet (1.022x ➖, 1↑ 2↓)
duckdb / duckdb (1.032x ➖, 0↑ 0↓)
File Size Changes (18 files changed, -0.2% overall, 11↑ 7↓)
Totals:
|
Benchmarks: FineWeb S3Verdict: No clear signal (environment too noisy confidence) How to read Verdict and Engines
datafusion / vortex-file-compressed (0.952x ➖, 1↑ 0↓)
datafusion / vortex-compact (1.142x ➖, 0↑ 2↓)
datafusion / parquet (1.034x ➖, 0↑ 0↓)
duckdb / vortex-file-compressed (1.026x ➖, 0↑ 0↓)
duckdb / vortex-compact (0.993x ➖, 0↑ 0↓)
duckdb / parquet (1.015x ➖, 0↑ 0↓)
|
Benchmarks: FineWeb NVMeVerdict: No clear signal (low confidence) How to read Verdict and Engines
datafusion / vortex-file-compressed (0.970x ➖, 0↑ 0↓)
datafusion / vortex-compact (0.949x ➖, 1↑ 0↓)
datafusion / parquet (0.955x ➖, 1↑ 0↓)
duckdb / vortex-file-compressed (0.960x ➖, 1↑ 0↓)
duckdb / vortex-compact (0.976x ➖, 0↑ 0↓)
duckdb / parquet (0.956x ➖, 1↑ 0↓)
File Size Changes (2 files changed, -0.0% overall, 0↑ 2↓)
Totals:
|
Benchmarks: Statistical and Population GeneticsVerdict: No clear signal (low confidence) How to read Verdict and Engines
duckdb / vortex-file-compressed (1.018x ➖, 0↑ 0↓)
duckdb / vortex-compact (1.015x ➖, 0↑ 0↓)
duckdb / parquet (1.015x ➖, 0↑ 0↓)
File Size Changes (2 files changed, +0.0% overall, 1↑ 1↓)
Totals:
|
794fc4c to
9810f14
Compare
e5baa81 to
6f42904
Compare
Benchmarks: Random AccessVortex (geomean): 0.988x ➖ How to read Verdict and Engines
unknown / unknown (0.995x ➖, 1↑ 1↓)
|
bfc91e8 to
81d2c45
Compare
Alignment::DEFAULT_ALIGNMENT = = Alignment::new(256)Alignment::DEFAULT_ALIGNMENT = Alignment::new(256)
|
@claude in depth review |
|
Claude finished @0ax1's task in 4m 18s —— View job In-depth reviewI read the full diff against What the PR does: Correctness1. pub fn empty() -> Self {
Self::empty_aligned(Alignment::DEFAULT_ALIGNMENT) // sets self.alignment = 256
}Empty buffers don't allocate (they use
This matches 2. The I checked the other
So no missed breakage in the chunked paths. Given this is now a general footgun, consider a follow-up that makes the surplus harder to misuse (e.g. a Design / docs3. Over-alignment is creation-time only — it's silently dropped on growth. // buffer_mut.rs:288-289
let mut bytes = BytesMut::with_capacity(new_capacity);
bytes.align_empty(self.alignment); // <- self.alignment, not the 256 over-alignmentSo a buffer built incrementally past its initial capacity (the common builder path) ends up only Performance — the "too aggressive" question (
|
Signed-off-by: Robert Kruszewski <github@robertk.io>
|
I'll change the empty function. Since it never allocated anything over aligning there is a mistake |
0ax1
left a comment
There was a problem hiding this comment.
Given that there are no perf regresssions, I think we're good to land this once the nits are resolved.
bitwise_not_vortex_buffer_mut[128/1024/2048] was the noisiest benchmark on CodSpeed after #8490: it flipped between the same two values in both directions (+27.1%/-10.66% etc.) on roughly half of ~47 recently merged PRs, including PRs changing only docs, uv.lock, or workflow YAML. The Not impl for an owned BitBufferMut runs bitwise_unary_op_mut in place - no allocation, no memcpy. At 128-2048 bits that is a handful of word ops, so the reported number is fixed divan harness overhead plus binary code layout, both of which shift with any unrelated code change. Those sizes never measured the operation at all, so remove them outright; 16384 and 65536, where the loop dominates, were never flagged and remain. Signed-off-by: Claude <noreply@anthropic.com> Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01T6PPcdrqcNeUkfi1EGd4oC
A small pool of microbenchmarks flips ±10-35% between two fixed values on unrelated PRs (including docs-only and lockfile-only changes), spamming every CodSpeed report. This PR fixes them (and removes only 1 benchmark). No `#[cfg(codspeed)]` gating; CI and local runs stay identical. One commit per benchmark. ## Changes - **mimalloc as global allocator** in the 5 flaky `vortex-array` bench files: `chunk_array_builder`, `dict_compress`, `varbinview_compact`, `compare`, `binary_ops` - **`bitwise_not_vortex_buffer_mut`**: drop the 128/1024/2048 sizes (measured only harness overhead) - **`slice_empty_vortex`**: rewrite as a 1024-iteration tight loop, renamed `slice_empty_tight_loop_vortex` - **`rebuild_naive` (vortex-zstd)**: the one benchmark removed instead of fixed — its cost is dominated by zstd-internal copies (glibc `ifunc`-resolved `memcpy`) that no bench-level change can stabilize, its fixture is degenerate (a 4-string dictionary with all-zero offsets), and ListView rebuild is already benchmarked across element types and list shapes in `vortex-array/benches/listview_rebuild.rs`. The crate's now-unused `divan` dev-dependency goes with it. <details> <summary>Which benchmarks were flaky, and the evidence</summary> Identified by reading the CodSpeed comments on the ~47 PRs merged since June 25 (post-#8490). The tell: the same benchmark flipping between the same two values, in both directions, on PRs that can't have affected it — including deny.toml-only (#8712, #8716), uv.lock-only (#8732), docs-only (#8737, #8728, #8685), and CI-YAML-only (#8660, #8683) changes. | Benchmark | Evidence | |---|---| | `bitwise_not_vortex_buffer_mut[128/1024/2048]` | ~half of all PRs — worst offender | | `chunked_varbinview_*` ×4 | ~20 PRs, both directions | | `chunked_bool_canonical_into[(1000,10)]` | ~2× flips (16µs ↔ 35µs) on 4 PRs | | `encode_varbin`, `encode_varbinview` | ~12 PRs; `encode_varbinview[(10000,4)]` also flipped on an earlier revision of this PR | | `compact`, `compact_sliced` (90%-utilization args) | ~8 PRs | | `compare_int_constant` | ±11.1% verbatim on ≥9 PRs | | `eq_i64_constant` | same ±11% signature incl. docs-only PR | | `slice_empty_vortex` | -14.66% verbatim on ~13 PRs | | `rebuild_naive` (vortex-zstd) | ~10 PRs, both directions | Watch list (left alone, below the ≥3-independent-sightings bar): `copy_nullable`/`copy_non_nullable[65536]` in `cast_decimal.rs`, `true_count_vortex_buffer[128]`. </details> <details> <summary>Root causes and why each fix matches</summary> - **Allocation in the timed region** → glibc malloc's code differs across CodSpeed runner images, so alloc-heavy benchmarks trace differently for byte-identical Vortex code. Vendored mimalloc removes glibc malloc from the trace. Empirical support: the only three bench files already using mimalloc (`single_encoding_throughput`, `common_encoding_tree_throughput`, `row_encode`) are the most alloc-heavy suites in the repo and were never flagged once in the 47-PR window. - **Sub-microsecond work** → the measurement is fixed harness overhead plus binary code layout, which shifts with any unrelated change. Fix by making the operation dominate: the in-place NOT (no alloc, no copy) keeps only sizes where the loop dominates; the empty slice runs 1024× per iteration, mirroring the neighboring `slice_tight_loop_vortex`. - **Environment-bound and low-signal** → `rebuild_naive`, per the justification above: unfixable at the bench level and redundant with the vortex-array ListView rebuild suite, so removed. </details> <details> <summary>Validation: A/A reruns and a stacked canary PR</summary> - **Expected one-time step changes on this PR**: swapping the allocator changes the trace of every benchmark in the touched files, so this PR's report shows a few ±10-20% level shifts (including on never-flaky `encode_primitives`, which just shares a file). These need a one-time acknowledgment on the CodSpeed dashboard; after merge every PR compares mimalloc-vs-mimalloc. - **A/A reruns** (same bench binaries measured three times, on separate runners and commits): every value reproduced exactly — 211.5µs, 137.1µs, 14.6µs, 26.3µs — with zero new flags across 1656 benchmarks. - **Canary #8743** (a #8681-style cold-string change stacked on this branch — the class of change that used to collect five false flags): **Performance Gate Passed**, `✅ 1660 untouched`, zero changes reported. </details> No public API changes; benchmark-only. https://claude.ai/code/session_01T6PPcdrqcNeUkfi1EGd4oC --------- Signed-off-by: Claude <noreply@anthropic.com> Co-authored-by: Claude <noreply@anthropic.com>
Default alignment of new buffer to 256