mirror of
https://github.com/PR0M3TH3AN/TORCH.git
synced 2026-11-02 19:01:55 +00:00
perf: visibility-gate dashboard render loop
Co-authored-by: PR0M3TH3AN <[email protected]>
This commit is contained in:
1 parent
e07b7f2c06
commit
19af4dcba5
13 files changed
+140
-70
No files matched your search
@@ -0,0 +1,16 @@
|
||||
# DECISIONS: perf-agent (2026-02-16)
|
||||
|
||||
## Decision: Visibility Gating for Dashboard Refresh Loop
|
||||
|
||||
- **Decision**: Modify the `setInterval` in `dashboard/index.html` to skip rendering if `document.hidden` is true.
|
||||
- **Rationale**: The dashboard currently re-renders the DOM every 30 seconds to update TTL bars, even when the tab is in the background. This wastes CPU cycles.
|
||||
- **Consequences**:
|
||||
- Reduced CPU usage when tab is hidden.
|
||||
- UI might be slightly stale when tab becomes visible, so we add a `visibilitychange` listener to force an immediate update.
|
||||
|
||||
## Alternatives Considered
|
||||
- Remove the interval entirely: Would stop updates.
|
||||
- Use `requestAnimationFrame`: Still runs (sometimes throttled) and more complex to manage with 30s intervals.
|
||||
|
||||
## Follow-ups
|
||||
- Monitor if users complain about stale data (should be mitigated by `visibilitychange`).
|
||||
Reference in new issue
Block a user