Merge Ω-W2-T2: throttle new-content enumeration off the 30/s timer tick

Extracts elapsedAtLeast to core/util with the GetTickCount wraparound asserted.
This commit is contained in:
2026-08-03 16:09:12 -04:00
7 changed files with 151 additions and 22 deletions
+12 -8
View File
@@ -958,20 +958,24 @@ the projects where the switch is slowest.
`enumerateLiveGuids` and their cadence inside `bankPanelRefresh`). **Does not own:** any other
panel TU, `view.cpp`, or the auto-tag RULES — only how often they are asked.
**Behavior.** `detectNewContent` (`panel_input.cpp:146`) runs `enumerateLiveGuids` (`:106-135`)
every tick of REAPER's `"timer"` registration (`main.cpp:341`, ~30/sec), regardless of panel
state — O(T + I) REAPER string calls plus ~4(T+I) allocations per tick, on every project. Throttle
the ENUMERATION, not the detection semantics: the same GUIDs must still be detected, the
first-poll and `reloadPending` re-baseline guards must still fire before any diff, and the
lane-minting pass must still run only on a tick that tagged. A slower cadence is a latency
change to an invisible background tag, and the track states the chosen interval and why.
**Behavior.** `detectNewContent` (`panel_input.cpp:147`) runs `enumerateLiveGuids` (`:106-135`)
every tick of REAPER's `"timer"` registration (`main.cpp:354`, ~30/sec), regardless of panel
state — O(T + I) REAPER string calls plus roughly 5 allocations per track and 6 per item per
tick (a per-element-type count, not the earlier `~4(T+I)` derivation, which undercounted; the
ratio the throttle buys is unaffected by the correction). Throttle the ENUMERATION, not the
detection semantics: the same GUIDs must still be detected, the first-poll and `reloadPending`
re-baseline guards must still fire before any diff, and the lane-minting pass must still run
only on a tick that tagged. A slower cadence is a latency change to an invisible background
tag, and the track states the chosen interval and why.
**Acceptance criteria.**
- New tracks and items are still auto-tagged into the active mode, and a project reload still
re-baselines rather than mass-tagging.
- The Ρ-W1-T1 rule survives: an added GUID that already carries a membership record is still
dropped, so a render-in-place result is not re-tagged to Design.
- The per-tick allocation count is measured before and after.
- The per-tick allocation count is derived, not measured: it needs live REAPER-side track/item
counts and a runtime allocation trap neither CTest nor this repo's tooling provides.
`[verify — DAW]`.
- The panel's own repaint cadence is unaffected.
**Prerequisites.** None beyond Ω-W1. **Discharges:** Ω.7's polling cost.