Commit 32d28bf
committed
perf: throttle mouse events and cache window list queries
Performance optimizations from upstream PR jordanbaird#842 patterns:
1. Mouse Event Throttling:
- Process 1 in 5 mouse moved events (80% reduction)
- Significantly reduces CPU usage during mouse movement
- Uses simple counter-based throttling for minimal overhead
2. Window List Caching:
- Cache menu bar window list for 0.5 seconds
- Reduces expensive WindowServer IPC calls
- Hit-testing now uses cached data instead of fresh queries
Combined Impact:
- Reduced CPU usage during mouse interaction
- Lower WindowServer communication overhead
- Smoother app responsiveness
- Better battery life on laptops
Build: Verified with xcodebuild - BUILD SUCCEEDED1 parent 721db1d commit 32d28bf
1 file changed
+20
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
24 | 33 | | |
25 | 34 | | |
26 | 35 | | |
| |||
90 | 99 | | |
91 | 100 | | |
92 | 101 | | |
93 | | - | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
94 | 107 | | |
95 | 108 | | |
96 | 109 | | |
| |||
494 | 507 | | |
495 | 508 | | |
496 | 509 | | |
497 | | - | |
498 | | - | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
499 | 516 | | |
500 | 517 | | |
501 | 518 | | |
| |||
0 commit comments