Repository navigation
perf(engine): add bench harness for parallel verify_chunk cores-vs-throughput (BR-3i.f) - #4653
Merged
Merged
Conversation
…roughput (BR-3i.f) BR-3i.c (PR #4640) replaced the length-only verify stub with a real strategy.compute(&chunk.data) comparison, so the per-chunk verify path now has measurable CPU cost. Adds a criterion harness in crates/engine/benches/parallel_verify_chunk.rs that sweeps: - Workload A: 4 files x 256 chunks x 1 MiB (large/few) - Workload B: 256 files x 64 chunks x 16 KiB (small/many) - Threads: 1, 2, 4, 8, and available_parallelism() - Strategies: MD4, MD5, XXH3 (the BR-3i.b supported set) Each cell pins both the applier concurrency limit and the rayon pool via ThreadPoolBuilder + pool.install so the dispatch surface is genuinely thread-bound. Payloads come from a seeded SmallRng keyed by (workload, file, chunk) for byte-identical reproducibility across runs. Per-chunk expected_strong digests are pre-computed outside the timed loop so each iteration exercises the full compute + compare path. Group throughput reports bytes/sec; chunks/sec is derivable from the per-cell chunk count and the reported wall time. No new runtime deps; rand is added to engine dev-dependencies (already a workspace dev-dep).
oferchen
force-pushed
the
perf/engine-parallel-verify-chunk-bench-br3if
branch
from
May 21, 2026 08:12
9a4b97f to
0f8a212
Compare
5 tasks
oferchen
added a commit
that referenced
this pull request
Aug 24, 2026
…roughput (BR-3i.f) (#4653) BR-3i.c (PR #4640) replaced the length-only verify stub with a real strategy.compute(&chunk.data) comparison, so the per-chunk verify path now has measurable CPU cost. Adds a criterion harness in crates/engine/benches/parallel_verify_chunk.rs that sweeps: - Workload A: 4 files x 256 chunks x 1 MiB (large/few) - Workload B: 256 files x 64 chunks x 16 KiB (small/many) - Threads: 1, 2, 4, 8, and available_parallelism() - Strategies: MD4, MD5, XXH3 (the BR-3i.b supported set) Each cell pins both the applier concurrency limit and the rayon pool via ThreadPoolBuilder + pool.install so the dispatch surface is genuinely thread-bound. Payloads come from a seeded SmallRng keyed by (workload, file, chunk) for byte-identical reproducibility across runs. Per-chunk expected_strong digests are pre-computed outside the timed loop so each iteration exercises the full compute + compare path. Group throughput reports bytes/sec; chunks/sec is derivable from the per-cell chunk count and the reported wall time. No new runtime deps; rand is added to engine dev-dependencies (already a workspace dev-dep).
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
Adds a criterion bench harness in
crates/engine/benches/parallel_verify_chunk.rsthat measures the cores-vs-throughput curve forParallelDeltaApplier::verify_chunkintroduced by BR-3i.c. Sweeps three axes per cell: workload shape, worker count, and negotiated checksum strategy.available_parallelism()rayon::ThreadPooland runs the applier underpool.installso the dispatch surface is genuinely thread-bound, not just nominally limited.SmallRng::seed_from_u64, keyed by(workload, file, chunk).expected_strongdigests are pre-computed outside the timed loop so each iteration exercises the realstrategy.compute(&chunk.data) + comparepath.Prerequisite
verify_chunkbody (strategy.compute(&chunk.data)compared againstexpected_strong). Without it this harness would only measure the length-only stub.Baseline numbers (Apple Silicon dev box,
--sample-size 10 --measurement-time 1)Throughput in bytes/sec, median of 10 samples.
Workload A - large_chunks_few_files (4 files x 256 chunks x 1 MiB)
Workload B - small_chunks_many_files (256 files x 64 chunks x 16 KiB)
Observations on the dev box:
These numbers are the BR-3i.f reference; absolute values depend on the host. Run the bench on the target box to capture machine-specific data.
Follow-on enabled
This harness is shape-compatible with BR-3j.f (re-bench after the DashMap migration in PR #4634). Both BR-3i.f and BR-3j.f drive the same
ParallelDeltaApplier::apply_batch_parallelsurface, so the BR-3j.f re-baseline reuses this bench unchanged.Test plan
cargo fmt --allcleancargo clippy --workspace --all-targets --all-features --no-deps -- -D warningscleancargo build -p engine --features parallel-receive-delta --bench parallel_verify_chunkcompilescargo bench -p engine --features parallel-receive-delta --bench parallel_verify_chunk -- --sample-size 10 --measurement-time 1 --warm-up-time 1produces output for all 30 cells (3 strategies x 5 thread counts x 2 workloads)