codegen-units = 1was found to regress performanceopt-level = 2retired 1.8% more instructions than the release default ofopt-level = 3(geometric mean overtools/instruction_counts.py; +6% on the 10k-tick pair workloads), so the release profile keeps the default.- Compare builds with
tools/instruction_counts.py: retired instructions are stable to about 0.3% on a busy host, while cycles vary by several percent. Instructions can mislead when a change swaps SIMD for scalar code: the scalarChaCha12block that starts eachTrialRngretires about as many instructions aschacha20's four-block NEON batch in half the cycles, soexp/sample_bounded_512x8retires 32% more instructions in 20% fewer cycles. Check cycles over several rounds for such changes. - Splitting the agent slice on every visit regressed large, mostly sleeping simulations by 11%; only simulations that scan names split it.
- An out-of-line
AgentContext::agent_idcost simulations with more than eight agents about 2%; it stays#[inline]. - Checking history capacity on every push regressed long simulations by 1-4%; small simulations reserve histories at construction instead.
- Sharing one cursor loop between dense and sparse ticks cost dense simulations 7-10%; dense ticks keep a plain range loop and sparse ticks are outlined.
- Separate dense and scheduled outer loops moved the dense tick and delivery out of line (+8% for small simulations); one loop serves both.
- The sparse scheduler's per-tick checks cost two-agent simulations about 2% of retired instructions with no measurable change in cycles.
- Padding
Messageby 8 bytes cost message-heavy simulations 1.5-5% and by 16 bytes 2-6%, so a boxed interrupt beside a fatArc<[u8]>payload was rejected; a const assertion keepsMessage<()>at 32 bytes. - The two 10k-tick pair workloads have bimodal minima that differ by 2-4% between runs of one binary; compare them over 9 or more rounds.