Skip to content

perf: specialize grouped sums for constant arrays - #9822

Closed
connortsui20 wants to merge 1 commit into
developfrom
ct/sum-constant
Closed

perf: specialize grouped sums for constant arrays#9822
connortsui20 wants to merge 1 commit into
developfrom
ct/sum-constant

Conversation

@connortsui20

Copy link
Copy Markdown
Member

Summary

Reuses one sum partial for fixed-size lists of primitive constant elements. Variable-size groups reuse the existing whole-array accumulator without slicing the elements.

Changes

Uses the existing Sum and SumV2 accumulation paths for nulls, NaNs, overflow, and signed zero, with focused tests for grouped behavior. Whole-array arithmetic and decimal handling remain unchanged.

Validation
  • cargo nextest run -p vortex-array --lib: 3,462 passed, 1 skipped.
  • cargo test --doc -p vortex-array: passed.
  • cargo clippy --all-targets --all-features -- -D warnings: passed.
  • Affected-crate Rust formatting passed. Full workspace formatting still reports four existing macro-format differences in vortex-duckdb and vortex-ffi, outside this PR.
Benchmark results

Local aarch64-apple-darwin medians with Rust 1.98.0 and 100 samples, using cargo bench -p vortex-array --bench aggregate_grouped -- sum_v2_constant --sample-count 100. Both modes use f185f493f4be4568e82d75fb8869f460e25e1c0f, with the baseline disabling the constant grouped kernel. Timings include finalization to a primitive array.

Fixed-size inputs contain 16,384 i32 values. The list-view input has 128 groups with sizes from 1 to 15.

Workload Specialized Kernel disabled
Fixed-size, 2-element groups 4.541 µs 5.646 ms
Fixed-size, 128-element groups 3.999 µs 87.79 µs
Variable-size list groups 70.97 µs 87.02 µs

Signed-off-by: Connor Tsui <connor.tsui20@gmail.com>
@codspeed-hq

codspeed-hq Bot commented Sep 9, 2026

Copy link
Copy Markdown

Merging this PR will regress 3 benchmarks

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

⚡ 6 improved benchmarks
❌ 3 regressed benchmarks
✅ 2184 untouched benchmarks
🆕 6 new benchmarks
⏩ 218 skipped benchmarks1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
WallTime arrow_checked_add_u32_neon[16384] 13.4 µs 20.3 µs -34.07%
Simulation decompress[u64, (4000, 1024)] 70.8 µs 86 µs -17.7%
WallTime mul_u32_nonnull_avx512 5.5 µs 6.2 µs -10.08%
WallTime mul_u64_nonnull_neon 20.6 µs 15.1 µs +36.24%
WallTime multiply_shapes_neon[(16384, PerRowPerRow)] 20.3 µs 17.2 µs +17.98%
WallTime mul_i64_nonnull_neon 20.2 µs 17.2 µs +17.71%
WallTime filtered_owned_i64_avx512[OneNullInEight] 26.3 µs 22.4 µs +17.12%
Simulation allocate_drop_arrow[0] 456.9 ns 402.7 ns +13.45%
WallTime mul_i32_nonnull_avx512 7.9 µs 7.1 µs +10.34%
🆕 Simulation sum_v2_constant_fixed[false, 128] N/A 1.4 ms N/A
🆕 Simulation sum_v2_constant_fixed[false, 2] N/A 82.6 ms N/A
🆕 Simulation sum_v2_constant_fixed[true, 128] N/A 168 µs N/A
🆕 Simulation sum_v2_constant_fixed[true, 2] N/A 229 µs N/A
🆕 Simulation sum_v2_constant_list[false] N/A 1.4 ms N/A
🆕 Simulation sum_v2_constant_list[true] N/A 1.2 ms N/A

Tip

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


Comparing ct/sum-constant (f185f49) with develop (e3b8eb2)

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.

@connortsui20
connortsui20 deleted the ct/sum-constant branch September 9, 2026 18:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog/performance A performance improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant