scripts: consolidate benchmarking into bench.py; record scan/hash & walker dead-ends - #102
Merged
Conversation
…alker dead-ends Replace the three overlapping bench-*.sh scripts with a single extensible Python harness, scripts/bench.py, and document two measured dead-ends so they are not re-attempted. bench.py subsumes bench-scan.sh (warm A/B scan-makespan), bench-scan-cold.sh (cold drop_caches variant) and bench-ram.sh (peak RSS): one tool that generates reproducible trees (reusing scripts/demo/gen.py), runs a matrix of binaries x io-threads x walk-threads x env-variants over declarative workload profiles, cold or warm, interleaved across rounds, reporting median/mean/min/max wall + user + sys (+ --rss peak RSS). Profiles live in a dict (realistic/mixed/bigfile/many/big/git) so future needs add a key, not a script. Cold runs now work via the sudoers `tee /proc/sys/vm/drop_caches`. scripts/demo/* is untouched (that is the GIF, not benchmarking). Add DUPEREMOVE_WALK_THREADS: a benchmark-only hook that overrides just the walker-thread count (decoupled from the csum/dedupe pools) so bench.py can sweep it. Measured conclusion (in CLAUDE.md): decoupling or doubling the walkers does nothing — they only feed the single __scan_file consumer, so past ~4 they are never the bottleneck; the csum pool (--io-threads) is. Default (unset) behavior is unchanged. CLAUDE.md also records that separating the walk from hashing into two sequential phases is not worth it (cold-benchmarked: byte-identical output, neutral-to-~3%-worse because it throws away walk/hash overlap). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
What
Replace the three overlapping
bench-*.shscripts with a single extensible Python harness,scripts/bench.py, and document two measured dead-ends so they aren't re-attempted.scripts/bench.py— one benchmark harnessSubsumes
bench-scan.sh(warm A/B scan-makespan),bench-scan-cold.sh(colddrop_cachesvariant) andbench-ram.sh(peak RSS). It:scripts/demo/gen.py),tee /proc/sys/vm/drop_caches) or--warm, interleaved across rounds with within-round shuffling,--rsspeak RSS).Profiles live in a dict (
realistic,mixed,bigfile,many,big,git) — future needs add a key, not a script.scripts/demo/*is untouched (that's the GIF, not benchmarking).DUPEREMOVE_WALK_THREADS— benchmark hook + a recorded dead-endOverrides only the walker-thread count (decoupled from the csum/dedupe pools) so
bench.pycan sweep it. Measured conclusion: decoupling or doubling the walkers does nothing — they only feed the single__scan_fileconsumer, so past ~4 they're never the bottleneck; the csum pool (--io-threads) is. Cold sweeps (io-threads pinned at 8):~/gitmedianmanymedianVerified real (not a no-op): the same harness's io-threads control swept 1→2→8 = 38.0/20.7/7.9 s,
DUPEREMOVE_WALK_THREADS=Nproduced exactlyNlivewalkerthreads, and each run stored 250k extents. Default (unset) behavior is unchanged.CLAUDE.md dead-ends
Also records that separating the walk from hashing into two sequential phases isn't worth it — cold-benchmarked as byte-identical output, neutral-to-~3%-worse (it throws away the walk/hash pipeline overlap).
Test
scripts/verify.shpasses: build (warnings = failure), 94 unit+integration tests, valgrind scan+dedupe+replay smoke.🤖 Generated with Claude Code