Skip to content

fix: Wire performance panel to worker metrics with zero-cost when closed#1145

Merged
braedonsaunders merged 1 commit into
mainfrom
claude/fix-performance-panel-GAJOE
Jan 30, 2026
Merged

fix: Wire performance panel to worker metrics with zero-cost when closed#1145
braedonsaunders merged 1 commit into
mainfrom
claude/fix-performance-panel-GAJOE

Conversation

@braedonsaunders

Copy link
Copy Markdown
Owner

The performance panel was completely broken because game logic runs exclusively in a Web Worker, which has its own PerformanceMonitor singleton. System timings and tick times were recorded in the worker but never sent to the main thread where the panel displays them.

Changes:

  • Add WorkerPerformanceMetrics type and setPerformanceCollection message
  • Add PerformanceMonitor.applyWorkerMetrics() to receive worker data
  • Implement toggle-based collection in GameWorker (10Hz when enabled)
  • Wire WorkerBridge to forward metrics to main thread PerformanceMonitor
  • Enable collection on PerformanceDashboard mount, disable on unmount

Performance characteristics:

  • Zero overhead when panel is closed (no timing, no messages)
  • 10Hz throttled metrics transfer when open (~100ms interval)
  • Efficient tuple serialization for system timings

https://claude.ai/code/session_0129n4vJK6gWdvXSBUEfMwsv

The performance panel was completely broken because game logic runs
exclusively in a Web Worker, which has its own PerformanceMonitor
singleton. System timings and tick times were recorded in the worker
but never sent to the main thread where the panel displays them.

Changes:
- Add WorkerPerformanceMetrics type and setPerformanceCollection message
- Add PerformanceMonitor.applyWorkerMetrics() to receive worker data
- Implement toggle-based collection in GameWorker (10Hz when enabled)
- Wire WorkerBridge to forward metrics to main thread PerformanceMonitor
- Enable collection on PerformanceDashboard mount, disable on unmount

Performance characteristics:
- Zero overhead when panel is closed (no timing, no messages)
- 10Hz throttled metrics transfer when open (~100ms interval)
- Efficient tuple serialization for system timings

https://claude.ai/code/session_0129n4vJK6gWdvXSBUEfMwsv
@braedonsaunders braedonsaunders merged commit e01117f into main Jan 30, 2026
4 checks passed
@braedonsaunders braedonsaunders deleted the claude/fix-performance-panel-GAJOE branch January 30, 2026 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants