Repository navigation
bench(alias): use BatchSize::PerIteration for cold-cache variants - #2731
Merged
Merged
Conversation
Follow-up to #2728: the `dispatch/cold/{1,100}` and `with_vars/cold/{1,100}` variants in `benches/alias.rs` were the last `iter_batched(invalidate_caches_auto, …, BatchSize::SmallInput)` site left in the suite. Under `SmallInput`, criterion calls the setup closure once per batch and times the routines back-to-back, so only iter 1 per batch is actually cold — iters 2-N hit the `worktrunk.default-branch` git-config entry that `build_hook_context` wrote on iter 1 (default-branch resolution is ~17ms on a synthetic repo). `PerIteration` runs `setup → time(routine)` per iter, so every measurement is genuinely cold. Measured on `dispatch/cold/1` (stub alias, 1 worktree): median 23.1ms → 23.9ms (+6.9%, within noise threshold). The correction is small here — alias dispatch is cheap (~23ms) and only the default-branch cache is being repopulated — but the direction is right and it brings the bench in line with the rest of the suite and the `benches/CLAUDE.md` "Cache Handling" guidance. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
worktrunk-bot
approved these changes
May 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up to #2728.
benches/alias.rswas the lastiter_batched(invalidate_caches_auto, …, BatchSize::SmallInput)site in the bench suite. UnderSmallInput, criterion calls the setup closure once per batch and times the routines back-to-back inside one timing window — so only iter 1 per batch is actually cold, and iters 2-N hit theworktrunk.default-branchgit-config entry thatbuild_hook_contextwrote on iter 1 (default-branch resolution is ~17ms on a synthetic repo perbenches/CLAUDE.md).BatchSize::PerIterationrunssetup → time(routine)per iter, so every measurement is genuinely cold.Measurement
dispatch/cold/1(stub alias, 1 worktree):Median +6.9% (p=0.05, "Change within noise threshold"). The correction is small — alias dispatch is cheap (~23ms) and only the default-branch cache is being repopulated, so each warm iter saved ~1ms — but the direction is right and it brings the bench in line with the rest of the suite (#2728) and the
benches/CLAUDE.md"Cache Handling" guidance.Test plan
cargo run -- hook pre-merge --yes— 3684 tests pass, 0 faileddispatch/cold/1run before+after on this branch with--save-baseline/--baseline