feat: add ParallelOp lookup for per-operation rayon thresholds#4030
Merged
Conversation
Replace direct field access on ParallelThresholds with a ParallelOp enum and a for_op() / with_op() accessor pair. Dispatch sites now read thresholds.for_op(ParallelOp::X) rather than coupling to the struct's field layout, so adding a new operation only requires extending the enum and struct without editing every call site. Defaults are unchanged (stat=64, signature=32, metadata=64, deletion=64). Existing with_stat/with_signature/with_metadata/ with_deletion builders are kept and now delegate to with_op so callers and tests need no migration. Updates the five production call sites in generator batch_stat, receiver candidate selection, receiver signature dispatch, receiver metadata application, and receiver deletion scanning.
oferchen
added a commit
that referenced
this pull request
May 18, 2026
Replace direct field access on ParallelThresholds with a ParallelOp enum and a for_op() / with_op() accessor pair. Dispatch sites now read thresholds.for_op(ParallelOp::X) rather than coupling to the struct's field layout, so adding a new operation only requires extending the enum and struct without editing every call site. Defaults are unchanged (stat=64, signature=32, metadata=64, deletion=64). Existing with_stat/with_signature/with_metadata/ with_deletion builders are kept and now delegate to with_op so callers and tests need no migration. Updates the five production call sites in generator batch_stat, receiver candidate selection, receiver signature dispatch, receiver metadata application, and receiver deletion scanning.
oferchen
added a commit
that referenced
this pull request
May 18, 2026
Replace direct field access on ParallelThresholds with a ParallelOp enum and a for_op() / with_op() accessor pair. Dispatch sites now read thresholds.for_op(ParallelOp::X) rather than coupling to the struct's field layout, so adding a new operation only requires extending the enum and struct without editing every call site. Defaults are unchanged (stat=64, signature=32, metadata=64, deletion=64). Existing with_stat/with_signature/with_metadata/ with_deletion builders are kept and now delegate to with_op so callers and tests need no migration. Updates the five production call sites in generator batch_stat, receiver candidate selection, receiver signature dispatch, receiver metadata application, and receiver deletion scanning.
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
ParallelThresholdswith aParallelOpenum plusfor_op()/with_op()accessors so dispatch sites readthresholds.for_op(ParallelOp::Stat)instead of coupling to the struct's field layout.with_stat/with_signature/with_metadata/with_deletionbuilders delegate towith_opso call sites and tests need no migration.Context
Closes #1554. Extends the per-workload sizing precedent set by the adaptive work-queue capacity change (PR #4012,
engine::concurrent_delta::work_queue::capacity) from delta dispatch to all rayon dual-path call sites: stat, signature, metadata, deletion. Aligns with the design note atdocs/design/per-op-adaptive-thresholds.mdand the profiling plan atdocs/audits/parallel-stat-batch-size-profile.md.Test plan
cargo nextest run -p transfer --all-features -E 'test(parallel)'cargo nextest run -p transfer --all-features -E 'test(thresholds)'cargo nextest run -p transfer --all-features -E 'test(for_op)'