71. TimeTree.run and offline_over zero-step-allocation callbacks (2026-11-21)
- Add
TimeTree<E>.run<M, R>(self, mark:, apply:, answer:, undo:) -> List<R>andoffline_over<E, M, R>(q, items, by:, mark:, apply:, answer:, undo:) -> List<R>instdlib/timetree.cp, keepingsteps()for compatibility. Reason:TimeTree.steps()materialized anO(q + m log q)List<TimeStep>and required callers to maintain a per-eventmarks: List<Mark>stack. Callback-drivenrun/offline_overtakes onemark()per non-empty segment-tree node, devirtualizes all four callbacks in C++ codegen with zerostd::function, and returns[answer(0), ..., answer(q - 1)]directly. Oncf2069f(n = 400k, q = 400k), median user time dropped from1.31sto1.05s(-20%) and peak RSS dropped from356 MBto146 MB(2.44x less memory). Reverse: removerun,run_node, andoffline_overfromstdlib/timetree.cpand restorett.steps()inproto/ports/ecnerwala/cf2069f.cp.