Skip to content

perf: hoist loop-invariant division out of reduce's cell loop#439

Open
henryiii wants to merge 1 commit into
boostorg:developfrom
henryiii:perf-reduce-cell-loop
Open

perf: hoist loop-invariant division out of reduce's cell loop#439
henryiii wants to merge 1 commit into
boostorg:developfrom
henryiii:perf-reduce-cell-loop

Conversation

@henryiii

@henryiii henryiii commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

This is fairly small change for a nice small speedup in reduction. From #437.

🤖 AI text below 🤖

reduce recomputed (end - begin) / merge for every axis of every cell and divided by merge even when it is 1 (every axis without a rebin command). This precomputes the reduced extent once per axis in the command buffer and skips the no-op division.

Benchmarked on 1M-cell histograms (Apple clang -O3): ~6-13% faster for 3d rebin/shrink, ~4% for 2d rebin, no change for 2d shrink.

Precompute the reduced axis extent once per axis instead of dividing
per cell per axis, and skip the merge division when merge == 1.
About 5-10% faster on large histograms (Apple clang -O3, M-series).

Assisted-by: ClaudeCode:claude-fable-5
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