perf(tui): precompute maintenance set, use cached sites #172

Merged
lerko merged 1 commits from perf/maint-map-group-queries into main 2026-07-02 00:12:28 +00:00
Owner

Summary

  • isMonitorInMaintenance replaced O(windows × sites) nested loops with O(1) map lookup. buildMaintSet runs once per refreshLive/handleTabData, not per call site (~10+ calls per render)
  • groupSparkline/groupUptime use m.sites (already on model) instead of engine.GetAllSites() which copies the full map under a mutex per group row

No user-facing changes — pure internal perf.

Test plan

  • 5 new tests: global window, targeted window, group propagation, expired ignored, incident ignored
  • All existing tests pass
  • Lint clean
  • Visual: dashboard renders identically to main
## Summary - `isMonitorInMaintenance` replaced O(windows × sites) nested loops with O(1) map lookup. `buildMaintSet` runs once per `refreshLive`/`handleTabData`, not per call site (~10+ calls per render) - `groupSparkline`/`groupUptime` use `m.sites` (already on model) instead of `engine.GetAllSites()` which copies the full map under a mutex per group row No user-facing changes — pure internal perf. ## Test plan - [x] 5 new tests: global window, targeted window, group propagation, expired ignored, incident ignored - [x] All existing tests pass - [x] Lint clean - [x] Visual: dashboard renders identically to main
lerko added 1 commit 2026-07-02 00:07:29 +00:00
perf(tui): precompute maintenance set, eliminate redundant GetAllSites
CI / test (pull_request) Successful in 1m45s
CI / lint (pull_request) Successful in 1m16s
CI / vulncheck (pull_request) Successful in 46s
a32a443a4a
Replace O(windows × sites) isMonitorInMaintenance with O(1) map lookup.
buildMaintSet runs once per refreshLive/handleTabData, not per call site.

groupSparkline/groupUptime now use m.sites (already on model) instead of
calling engine.GetAllSites() which copies the full map under a mutex.
lerko merged commit a32a443a4a into main 2026-07-02 00:12:28 +00:00
lerko deleted branch perf/maint-map-group-queries 2026-07-02 00:12:28 +00:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: lerkolabs/uptop#172