Migrate the algebra benchmark suite to criterion#269
Conversation
Replace the `bencher` harness with `criterion` (plus `pprof` flamegraph output) and add a general benchmark suite for the algebra crate: - `benches/common/mod.rs`: shared helpers for algebra-multiplication and module-action benchmarks, plus Steenrod-module loading. - `benches/milnor.rs`: the Milnor multiply, ported to criterion. - `benches/multiplication.rs`, `benches/module_action.rs`, `benches/nassau_milnor.rs`: new coverage of element multiplication, module actions, and the Nassau-regime Milnor multiply. This is pure benchmark infrastructure with no source-code dependencies, split out of the Nassau GPU work so it can land on its own. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UPYvsLdEfitgCbAiPxxx3U
|
Warning Review limit reached
Next review available in: 45 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughChangesThe algebra crate migrated benchmarks from Bencher to Criterion, added pprof flamegraph profiling, and introduced shared utilities plus new workloads for multiplication, module actions, and Nassau Milnor multiplication. Algebra benchmark suite
Estimated code review effort: 3 (Moderate) | ~25 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@ext/crates/algebra/benches/common/mod.rs`:
- Around line 231-245: Update the loop nesting in the act benchmark so the
inputs/mod_degree loop is outermost and the op_idx loop is inner, matching
act_on_basis. Keep scratch sizing, zeroing, module.act, and black_box within the
per-mod_degree iteration so each degree slice incurs that harness overhead only
once.
In `@ext/crates/algebra/benches/milnor.rs`:
- Around line 18-37: Update the benchmark around
PPartMultiplier::<MOD4>::new_from_allocation to use iter_batched, constructing
or hoisting PPartAllocation::default() in the setup phase so allocation is
excluded from timing. Replace the per-item correctness assertions with
std::hint::black_box on the iteration results, keeping the benchmark focused on
multiplier execution and retaining both MOD4 and non-MOD4 paths as needed.
In `@ext/crates/algebra/benches/module_action.rs`:
- Around line 31-47: Move the BenchmarkGroup creation and finalization out of
the basis loop, keeping one group per spec.name while iterating over supported
AlgebraType values. Preserve the existing module loading, skip behavior, and
bench_module_action calls so Milnor and Adem benchmarks appear side by side in
the same Criterion report.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: aaa095c1-fa60-41dc-bda4-5ddda4fde418
📒 Files selected for processing (6)
ext/crates/algebra/Cargo.tomlext/crates/algebra/benches/common/mod.rsext/crates/algebra/benches/milnor.rsext/crates/algebra/benches/module_action.rsext/crates/algebra/benches/multiplication.rsext/crates/algebra/benches/nassau_milnor.rs
- module_action: create one Criterion group per module (outside the base loop) so the Milnor and Adem bases share a report instead of landing in separate same-named runs. - milnor: hoist the `PPartAllocation` into `iter_batched` setup so allocation is excluded from the timed window, and `black_box` the yielded coefficients instead of asserting inside the hot loop. - common: match the `act` benchmark's loop nesting to `act_on_basis` (size/zero scratch and `black_box` once per degree slice) so the two are comparable. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UPYvsLdEfitgCbAiPxxx3U
|
I'll just go ahead and merge this since it's self-contained and not user-facing. |
* Migrate the algebra benchmark suite to criterion Replace the `bencher` harness with `criterion` (plus `pprof` flamegraph output) and add a general benchmark suite for the algebra crate: - `benches/common/mod.rs`: shared helpers for algebra-multiplication and module-action benchmarks, plus Steenrod-module loading. - `benches/milnor.rs`: the Milnor multiply, ported to criterion. - `benches/multiplication.rs`, `benches/module_action.rs`, `benches/nassau_milnor.rs`: new coverage of element multiplication, module actions, and the Nassau-regime Milnor multiply. This is pure benchmark infrastructure with no source-code dependencies, split out of the Nassau GPU work so it can land on its own. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UPYvsLdEfitgCbAiPxxx3U * Address review: tighten benchmark measurement - module_action: create one Criterion group per module (outside the base loop) so the Milnor and Adem bases share a report instead of landing in separate same-named runs. - milnor: hoist the `PPartAllocation` into `iter_batched` setup so allocation is excluded from the timed window, and `black_box` the yielded coefficients instead of asserting inside the hot loop. - common: match the `act` benchmark's loop nesting to `act_on_basis` (size/zero scratch and `black_box` once per degree slice) so the two are comparable. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UPYvsLdEfitgCbAiPxxx3U --------- Co-authored-by: Claude <noreply@anthropic.com>
* Migrate the algebra benchmark suite to criterion Replace the `bencher` harness with `criterion` (plus `pprof` flamegraph output) and add a general benchmark suite for the algebra crate: - `benches/common/mod.rs`: shared helpers for algebra-multiplication and module-action benchmarks, plus Steenrod-module loading. - `benches/milnor.rs`: the Milnor multiply, ported to criterion. - `benches/multiplication.rs`, `benches/module_action.rs`, `benches/nassau_milnor.rs`: new coverage of element multiplication, module actions, and the Nassau-regime Milnor multiply. This is pure benchmark infrastructure with no source-code dependencies, split out of the Nassau GPU work so it can land on its own. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UPYvsLdEfitgCbAiPxxx3U * Address review: tighten benchmark measurement - module_action: create one Criterion group per module (outside the base loop) so the Milnor and Adem bases share a report instead of landing in separate same-named runs. - milnor: hoist the `PPartAllocation` into `iter_batched` setup so allocation is excluded from the timed window, and `black_box` the yielded coefficients instead of asserting inside the hot loop. - common: match the `act` benchmark's loop nesting to `act_on_basis` (size/zero scratch and `black_box` once per degree slice) so the two are comparable. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UPYvsLdEfitgCbAiPxxx3U --------- Co-authored-by: Claude <noreply@anthropic.com>
Splits the benchmark infrastructure out of the Nassau GPU work (#264) so it can land on its own.
What
bencherharness withcriterion(pluspproffor flamegraph output).benches/common/mod.rs— shared helpers for algebra-multiplication and module-action benchmarks, plus Steenrod-module loading.benches/milnor.rs— the Milnor multiply, ported to criterion.benches/multiplication.rs— element multiplication across Adem/Milnor.benches/module_action.rs— module actions.benches/nassau_milnor.rs— the Nassau-regime (p = 2) Milnor multiply.Notes
This is pure benchmark infrastructure — no source-code changes, no dependency on the GPU work. It builds against the current
master.Test plan
cargo check -p algebracargo bench --no-run -p algebra— every bench target compiles (milnor,multiplication,module_action,nassau_milnor)🤖 Generated with Claude Code
Generated by Claude Code
Summary by CodeRabbit