Repository navigation
fix(criterion): avoid duplicate setup in simulation iter_batched - #198
Conversation
Merging this PR will regress 4 benchmarks
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| ❌ | WallTime | hamiltonian_cycle[5] |
935 ns | 1,571 ns | -40.48% |
| ❌ | WallTime | add |
2 ns | 3 ns | -33.33% |
| ❌ | WallTime | rem |
5 ns | 6 ns | -16.67% |
| ❌ | WallTime | graph_coloring[6] |
1.1 µs | 1.2 µs | -3.35% |
| ⚡ | WallTime | iter_batched_ref_large_input |
13 ns | 6 ns | ×2.2 |
| ⚡ | WallTime | bench_array1[4] |
2 ns | 1 ns | ×2 |
| ⚡ | WallTime | graph_coloring[4] |
1,331 ns | 989 ns | +34.58% |
| ⚡ | WallTime | hamiltonian_cycle[6] |
1,145 ns | 923 ns | +24.05% |
| ⚡ | WallTime | iter_batched_large_input |
9 ns | 8 ns | +12.5% |
| ⚡ | WallTime | iter_with_setup |
47 ns | 44 ns | +6.82% |
| ⚡ | WallTime | add_two_integers[(255, 255)] |
19 ns | 18 ns | +5.56% |
| ⚡ | WallTime | add_two_integers[(42, 13)] |
19 ns | 18 ns | +5.56% |
| ⚡ | WallTime | iter_batched_per_iteration |
58 ns | 56 ns | +3.57% |
Tip
Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.
Comparing cod-3941-fix-duplicate-setup-in-criterion-simulation-iter_batched (76685ee) with main (5aaf570)
[Medium impact] The PR appears safe to merge. SummaryFixes synchronous
No actionable issues found. Tests were not run during this review.
|
9c372b6 to
bae9321
Compare
Use the input already prepared outside measurement instead of calling setup again for the measured iteration. This prevents an unused input from remaining alive during the routine. Add regression coverage for setup counts and input lifetime.
bae9321 to
76685ee
Compare
TLDR: Reuse the prepared input in simulation
iter_batchedinstead of running setup twice for the measured iteration.RUSTFLAGS="--cfg codspeed"; the new test fails before the fix. A native lifecycle probe reports 6 setups and 6 routine calls. Native instrumentation was unavailable, so no performance claim is made.Fixes COD-3941