Files
airdef/airdef-mod
chexit 24f3485ebb
build / mod (push) Failing after 30s
save: assemble the air section with write! instead of += &format!
Sim::air_text built the save text with `head += &format!(...)` per contact
and `line += &format!(...)` per relief run, and Drone::air_line did the same
for a route point. Each of those allocated a temporary String and re-copied
the whole growing buffer, so the cost was quadratic in the section's size.
The head is not covered by the fits check (only the drone/queue body is): up
to 8 relief grids of 40k run-length tokens each plus 4096 contact lines. On a
heavy raid the autosave's tick therefore exhausted its 300M fuel while
formatting — the crash was in Sim::air_text.

Format directly into the buffer now (std::fmt::Write, push_str, push), which
grows it amortized with no per-token temporary. Nothing else changes: the
format, every MAX_* bound and the byte-budget logic are untouched.

The output is byte-identical: the same air_text over a relief-heavy raid
state and over the 600-drone byte-bound state hashes and measures the same
before and after (64a1787d37047447, 894 and 747942 bytes).
2026-11-21 18:46:19 +03:00
..