Skip to content

feat: add ParallelOp lookup for per-operation rayon thresholds#4030

Merged
oferchen merged 1 commit into
masterfrom
feat/per-operation-adaptive-thresholds-1554
May 14, 2026
Merged

feat: add ParallelOp lookup for per-operation rayon thresholds#4030
oferchen merged 1 commit into
masterfrom
feat/per-operation-adaptive-thresholds-1554

Conversation

@oferchen
Copy link
Copy Markdown
Owner

Summary

  • Replaces direct field access on ParallelThresholds with a ParallelOp enum plus for_op() / with_op() accessors so dispatch sites read thresholds.for_op(ParallelOp::Stat) instead of coupling to the struct's field layout.
  • Defaults preserved (stat=64, signature=32, metadata=64, deletion=64). Existing with_stat / with_signature / with_metadata / with_deletion builders delegate to with_op so call sites and tests need no migration.
  • Updates the five production dispatch sites: generator batch stat, receiver candidate stat, receiver signature dispatch, receiver metadata apply, receiver deletion scan.

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 at docs/design/per-op-adaptive-thresholds.md and the profiling plan at docs/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)'
  • CI: fmt+clippy, nextest (stable), Windows, macOS, Linux musl

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.
@github-actions github-actions Bot added the enhancement New feature or request label May 14, 2026
@oferchen oferchen merged commit e091033 into master May 14, 2026
38 of 39 checks passed
@oferchen oferchen deleted the feat/per-operation-adaptive-thresholds-1554 branch May 14, 2026 14:57
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant