Skip to content

Det Sweep: a shard proves its longest case first (Part of #5882) - #5947

Merged
squid-protocol merged 1 commit into
mainfrom
perf/5882-det-longest-first
Oct 22, 2026
Merged

squid-protocol merged 1 commit into
mainfrom
perf/5882-det-longest-first

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Part of #5882 (CI speed).

Problem: det_port.py run proved a shard's cases in name order (ThreadPoolExecutor.map). A long case could start last and hold the shard while the other workers sat idle. In run 39696713590, carddemo-dailyval (276 s), carddemo-posttran (223 s) and carddemo-intcalc (196 s) each set their shard's end.

What it does: det_port.proof_order() starts the cases longest first. It uses the recorded durations the shards are already balanced by (proof_sweep.load_durations / case_weights; an unmeasured case weighs the median). On CI the plan merges the newest measured durations into that same file. summary.json keeps its order, and verdicts cannot change: only the start order does.

Expected (simulated on the current plan with det_sweep_durations.json, 4 workers a shard):

name order longest first
six det shards, summed sweep 1301 s 1136 s (-13%)
all twelve shards (det + Db2) 4478 s 4210 s (-6%)

Most shards then sit at their lower bound, max(work / 4, longest case).

Checked:

  • A 3-case non-Db2 sweep against current main: ab_compare.py SAME on verdicts, outputs, coverage and files.
  • New tests/tools/test_det_port_order.py: longest first, ties by name, unmeasured = median.

🤖 Generated with Claude Code

det_port.py run proved a shard's cases in name order (ThreadPoolExecutor.map), so a
long case could start last and hold the shard while the other workers idled. It
starts them longest first now, by the same recorded durations the shards are
balanced by (an unmeasured case weighs the median). summary.json keeps its order.

Simulated on the current plan with det_sweep_durations.json, 4 workers a shard:
the six det shards 1301 s -> 1136 s of sweep (-13%), all twelve 4478 -> 4210 s (-6%).
A 3-case sweep against current main: SAME verdicts, outputs, coverage and files.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01E977ZMkfHVAsLSWrDLDaW5
@squid-protocol squid-protocol added the shepherd:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md label Oct 22, 2026
@squid-protocol

Copy link
Copy Markdown
Owner Author

No description provided.

@squid-protocol
squid-protocol merged commit e5254cf into main Oct 22, 2026
38 checks passed
@squid-protocol
squid-protocol deleted the perf/5882-det-longest-first branch October 22, 2026 12:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

shepherd:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant