Status: done (2026-11-23)
Priority: 2
Size: M
Design ref: design.md section 7, Opportunities (cached per holder: Agreed, 10 Nov); docs/cost.md (the ten rules); docs/review-agency.md, section 3; docs/review-jobs.md, sections 3 and 10
Goal: “Jobs refresh and matching” is 49 ms of 109 ms a game day at populous small, seed 7, two years (332 to 346 living), 45% of simulation time and the longest single call (refreshJobs, 59 ms); scaled linearly it is about 145 ms of the 200 ms budget at 1,000 living. Measure it by part before changing anything: the availability asks by kind (oppAsk; available of sim/kinds and its domains), the allotment (dayPair, dayTake), the routes begun by the commands the planner issues, the due-queue, the sweep. Then cut the largest part by the rule of docs/cost.md it breaks: if it is the asks, build the cache design.md agrees (a holder’s opportunities cached, rebuilt on its planning day and when its rights or stores change), by dirty marks the owners of rights and stores already raise where they exist. Standing duties (VB-1553) changes allot beside this task: keep out of allot unless the measure says it is the largest part.
Acceptance criteria:
node --cpu-prof on tools/sim.js, populous small, seed 7, 2 years), named as a description, not a result (other agents use the machine).node tests/counters.js, before and after; --update records the intended change), and on a late save (node tools/sim.js --load FILE --years 1 --report counts, a fixture if one is at hand; else said so). Unticked: the largest part is the allotment, and within the Decided rule a tenth was to be had, not a third: dayPair 21.44 to 19.32 a pawn-day at populous small (seed 7, 2 years), 10.15 to 9.17 on the tiny probe (tests/counters.js, recorded); no late fixture is at hand (tests/fixtures is empty). The rest waits for Kim’s answer (the question below).node tools/same.js --base REF prints same; or each change of behaviour named in a line with its reason, and then hungry household-days and the harvest before and after at seed 7.sim/saves DERIVED), has one owner in src/owners.json, is rebuilt after a load (tests/saves.js passes: a loaded run does not drift), and an invariant or a test holds it equal to the uncached answer on a constructed state.task, ready when their criteria are stated).npm run format and npm run verify pass.allotChanged and allot: 26% from refreshJobs, 5% from lookForWork), the commands the planner issues 22% (takeDay’s 19.6%, of which the walk begun 41% and findRoute 25%; allot’s calls 2.9%), the asks 17.5% (12% and 5.6%), the review itself 17% (reviewed: its event’s listeners over half, the outlook 24% of it), landStep 4%, the due-queue, the sweep and the rest 8%. By counters a pawn-day: dayPair 21.44, oppAsk 14.07, dayTake 6.25, planReview 0.19, routeSearch 1.27.allot itself is untouched (VB-1553 works in it). Cut: a village’s review alone no longer allots its households’ days anew; a task of the village posted or taken down still does (design.md section 7, The day’s work, names no review but the household’s). The one change of behaviour.tools/balance.js, grain a household-year by cattle wintered, 0 to 5.7): 266, 243, 346, 389 before; 273, 272, 266, 389 after. dayPair fell 10, 11, 7 and 10% on the four seeds.tests/outside.js (its couple’s liking faded unless the days brought them together: kept fond on the way), tests/relations.js (renormalising drops a tie to the dead: the check now allows it).