VB-129: Spread the moving round over several steps
Status: done
Priority: 2
Size: S
Arch: tooling
Phase: implement
Design ref: Systems overview (Across systems: cost; a budget per system).
Goal: The moving round (heirs, expansion, demand, households) takes about 1 s in one simulation step on populous medium, which the page shows as a freeze once a year, and which blocks the performance budget (VB-088). Do the same work in slices, one per step, with the same result.
Acceptance criteria:
The round is divided into slices (for example per village or per phase) that run on consecutive 6-minute steps, in a fixed order; no slice runs longer than 50 ms on populous medium at seed 7 (measured with tests/perf.js’s draft in VB-088’s note, or a scratch script reported in the PR).
Anything the slices leave half-done is consistent between steps: a save at any step (VB-074) loads and finishes the round; tests/lib/invariants.js holds between slices.
If the result differs from the single-step round only through ordering, re-record the golden file and list the changed entries in the PR; otherwise tests/golden.json is unchanged.
Meetings (75 ms) are checked too and sliced if they exceed 50 ms at 1,000 pawns.
Notes / questions:
Raised by the review of 31 October 2026, after VB-088’s nightly run showed a longest step of 1016 ms. Unblocks VB-088.
Renumbered from VB-117 when the review was rebased onto main (31 October 2026): main had since used VB-116 to VB-118. The numbers in the goal were measured at 243d9dd.
2026-10-31 (VB-145): the round’s cost was its heir rankings, cached now; it takes about 20 ms in one step on populous medium at seed 7 (1,305 ms before in year 1), and the meetings 16 ms. The goal, no step over 50 ms, is met without slicing. Kim: close this task as met by VB-145, or keep it for the save-at-any-step case (VB-074)? See QUESTIONS.md.
Kim, 2 Nov 2026: closed as met by VB-145 (the round takes about 20 ms in one step). If saves (VB-074) ever need to stop inside the round, a new task slices it.