Problem
After running Rustcast for several hours, macOS mouse responsiveness degrades significantly. The mouse becomes noticeably slow and unresponsive, with input events appearing to have 50-200ms delays. The issue is reproducible and occurs even if the laptop goes to sleep during the Rustcast session.
Root Cause Analysis
System Diagnostics (captured 2026-06-12 14:07:33):
WindowServer CPU Utilization
- With Rustcast running: WindowServer at 38.0% CPU
- After killing Rustcast: WindowServer dropped to 1.4% CPU (96.3% reduction ✓)
This is the critical finding: Rustcast is causing macOS's display compositing and input event processor (WindowServer) to become severely overloaded.
System State When Rustcast Active
- Memory Used: 15 GB / 16 GB (93.75%)
- Memory Compressor: 409,262 pages compressed
- Physical Free Memory: 306 MB
- System Uptime: 21 hours
- Laptop: Had gone to sleep during Rustcast session
Memory Improvement Post-Fix
- Pages in compressor: 409,262 → 182,726 (-55%)
- Memory free %: 69% → 71%
Technical Details
The Problem
When Rustcast has been running for several hours, it causes macOS's WindowServer (the display compositing and input event processor) to spike to 38% CPU usage, creating a bottleneck that delays mouse input processing.
Why This Matters
- macOS WindowServer is a single-threaded process that:
- Receives input events (mouse, keyboard, trackpad)
- Composites all windows/layers
- Manages GPU command buffers
- When Rustcast causes excessive rendering work, WindowServer CPU maxes out
- Input events get queued behind rendering operations
- Result: Laggy, unresponsive mouse
System Information
- Device: MacBook Air (Mac14,2) with Apple M2
- OS: macOS 26.3 (25D125)
- RAM: 16 GB LPDDR5
- Display: 2560 x 1664 Retina
Reproduction Steps
- Launch Rustcast
- Let it run for several hours (laptop may sleep during this time)
- Observe mouse responsiveness - should become sluggish
- Monitor Activity Monitor: Check WindowServer CPU usage (should be ~38%)
- Kill Rustcast:
pkill -9 rustcast
- Observe: Mouse responsiveness returns to normal immediately, WindowServer CPU drops to <2%
Evidence
Before/After comparison:
WindowServer CPU: 38.0% → 1.4% ✓
Memory in Compressor: 409K pages → 182K pages ✓
System Idle CPU: 78.32% → 82.92% ✓
Recommended Investigation
- Check if Rustcast is creating excessive GPU draw calls
- Review rendering loop - may be redrawing more frequently than necessary
- Profile Metal GPU utilization with XCode Instruments
- Check if Rustcast is maintaining large memory buffers
- Verify GPU command buffer submission rates
- Test behavior after system sleep/wake cycles
Impact
- Severity: High - Makes system unusable during extended Rustcast sessions
- Frequency: Consistent and reproducible after several hours
- Timing: Appears to accumulate over time, may worsen if laptop sleeps during session
- Affected Users: Any macOS user running Rustcast for extended periods
Problem
After running Rustcast for several hours, macOS mouse responsiveness degrades significantly. The mouse becomes noticeably slow and unresponsive, with input events appearing to have 50-200ms delays. The issue is reproducible and occurs even if the laptop goes to sleep during the Rustcast session.
Root Cause Analysis
System Diagnostics (captured 2026-06-12 14:07:33):
WindowServer CPU Utilization
This is the critical finding: Rustcast is causing macOS's display compositing and input event processor (WindowServer) to become severely overloaded.
System State When Rustcast Active
Memory Improvement Post-Fix
Technical Details
The Problem
When Rustcast has been running for several hours, it causes macOS's WindowServer (the display compositing and input event processor) to spike to 38% CPU usage, creating a bottleneck that delays mouse input processing.
Why This Matters
System Information
Reproduction Steps
pkill -9 rustcastEvidence
Before/After comparison:
Recommended Investigation
Impact