mirror of
https://github.com/PR0M3TH3AN/TORCH.git
synced 2026-10-31 18: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,19 @@
|
||||
# Context: perf-agent (2026-02-16)
|
||||
|
||||
## Goal
|
||||
Improve app responsiveness by finding and fixing background CPU/network work.
|
||||
|
||||
## Scope
|
||||
- Focus on "Visibility gating" for `dashboard/index.html`.
|
||||
- Run grep searches for performance patterns.
|
||||
- Ensure `INITIAL_BASELINE.md` exists.
|
||||
|
||||
## Constraints
|
||||
- Minimal changes.
|
||||
- Safe changes only.
|
||||
- No network access to external sites.
|
||||
- Running as a simulated agent (Jules).
|
||||
|
||||
## Assumptions
|
||||
- `dashboard/index.html` is the primary entry point for the dashboard.
|
||||
- `setInterval` in `dashboard/index.html` runs even when tab is hidden, wasting CPU.
|
||||
@@ -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`).
|
||||
@@ -0,0 +1,13 @@
|
||||
# TEST LOG: perf-agent (2026-02-16)
|
||||
|
||||
## Verification Steps
|
||||
|
||||
1. **Static Analysis**: Verify `dashboard/index.html` contains `document.hidden` check inside `setInterval`.
|
||||
2. **Static Analysis**: Verify `dashboard/index.html` contains `document.addEventListener('visibilitychange', ...)` handler.
|
||||
3. **Linting**: Run `npm run lint` to ensure no syntax errors or style violations.
|
||||
|
||||
## Results
|
||||
|
||||
- [x] Static Analysis (Hidden Check): Passed (Verified in `dashboard/index.html`)
|
||||
- [x] Static Analysis (Visibility Listener): Passed (Verified in `dashboard/index.html`)
|
||||
- [ ] Linting: Scheduled for Scheduler Completion step.
|
||||
@@ -0,0 +1,10 @@
|
||||
# TODO: perf-agent (2026-02-16)
|
||||
|
||||
- [ ] Create context file.
|
||||
- [ ] Run grep searches.
|
||||
- [ ] Create hits file.
|
||||
- [ ] Implement visibility gating in `dashboard/index.html`.
|
||||
- [ ] Document decisions.
|
||||
- [ ] Create test logs.
|
||||
- [ ] Create daily report.
|
||||
- [ ] Commit and push.
|
||||
Reference in new issue
Block a user