You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Ask: Cache the event-drawer expanded-log lines in main.gd render_event_drawer() so the per-render string-array allocation only happens when the event list changes rather than on every event_rev bump.
Expected files: scripts/main.gd
Problem:scripts/main.gd:1829-1848render_event_drawer() runs whenever sim.event_rev ticks. The collapsed-label branch sets a single event_drawer_label.text and is cheap. The expanded-log branch, however, builds a fresh lines := [] Array, runs six "t%02d %s" % [...] format calls, then calls "\n".join(lines) to assign to event_drawer_log.text. Each event_rev bump (every push_event, which fires on every ambient drop, milestone completion, goal completion, recruit, build queue, build finish, food upkeep tick, break completion, and stale-reservation cleanup) pays that allocation cost. The 2026-07-15 audit (#279 finding 8) flagged this as a future concern; it has not been addressed.
render_event_drawer caches the joined drawer text (e.g. cached_text: String + last_rendered_size: int keyed by event list identity) and only recomputes when the last 6 events actually changed
Inactive colonies (no recent pushes) do zero allocation in render_event_drawer beyond the event_rev compare
Visual output for the drawer matches the current behaviour byte-for-byte (event_drawer_log.text is the same string for the same event list)
A simple test scenario: queue a push_event, assert the cached text updated once; idle for a tick, assert no recomputation
Ask: Cache the event-drawer expanded-log lines in main.gd render_event_drawer() so the per-render string-array allocation only happens when the event list changes rather than on every event_rev bump.
Expected files: scripts/main.gd
Problem:
scripts/main.gd:1829-1848render_event_drawer()runs wheneversim.event_revticks. The collapsed-label branch sets a singleevent_drawer_label.textand is cheap. The expanded-log branch, however, builds a freshlines := []Array, runs six"t%02d %s" % [...]format calls, then calls"\n".join(lines)to assign toevent_drawer_log.text. Each event_rev bump (every push_event, which fires on every ambient drop, milestone completion, goal completion, recruit, build queue, build finish, food upkeep tick, break completion, and stale-reservation cleanup) pays that allocation cost. The 2026-07-15 audit (#279 finding 8) flagged this as a future concern; it has not been addressed.Evidence:
scripts/main.gd:1829—func render_event_drawer() -> void:— early-return gate at_drawer_event_rev == sim.event_revscripts/main.gd:1845— commentUpdate expanded log with recent history (last 6 events)scripts/main.gd:1846—var lines := []— array allocated per callscripts/main.gd:1847—lines.append("t%02d %s" % [int(entry.tick), String(entry.get("text", ""))])— format string per event in the loopscripts/main.gd:1848—event_drawer_log.text = "\n".join(lines) if not lines.is_empty() else "No events yet."— second string allocation from join()Acceptance:
event_drawer_log.textis the same string for the same event list)