-
-
Notifications
You must be signed in to change notification settings - Fork 470
CPU Hangs on macOS 26.2 (Tahoe) #5251
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
Edit: Done |
7c652f1 to
31b0dfa
Compare
31b0dfa to
fdab6a8
Compare
|
This should be ready to go! And I have another 80% speed up coming shortly 😉 |
|
Will need your opinion on leaving the performance logger (only debug builds) |
|
Summary from Cursor/Sonnet 4.5: Staged Changes Summary - macOS 15.2 Hang Fix🎯 PRIMARY FIX: External Event Flood ThrottlingRoot Cause IdentifiedWhile rapidly pressing Tab, external accessibility events (window title changes, moves, etc.) from background apps were triggering hundreds of concurrent expensive operations ( Before Fix: 275+ concurrent calls → 6-9 second cumulative hang 📝 FILE-BY-FILE BREAKDOWN1. src/ui/App.swift (+45 lines)Purpose: Core external event throttling mechanism Key Changes:
Impact: 🎯 PRIMARY FIX - Eliminates the hang completely 2. src/api-wrappers/PerfLogger.swift (NEW FILE, +34 lines)Purpose: Performance logging infrastructure Key Features:
Usage: PerfLogger.log("Operation took 50ms")
// Output: [14:30:45] [PERF] Operation took 50msImpact: Enables future performance debugging without affecting production 3. src/logic/Spaces.swift (+78 lines modified)Purpose: Performance logging for WindowServer API calls Key Changes:
Example Output: Impact: Visibility into WindowServer performance, confirms APIs are fast 4. src/logic/Windows.swift (+61 lines)Purpose: Performance logging for window list operations Key Changes:
Example Output: Impact: Identifies bottlenecks (window loop), confirms Tab press is fast 5. src/ui/main-window/ThumbnailsPanel.swift (+13 lines)Purpose: Layout throttling (existing optimization, kept) Key Changes:
Impact: Secondary defense against external event layouts 6. src/ui/main-window/ThumbnailView.swift (+105 lines)Purpose: Caching optimizations (existing, kept from previous fixes) Key Changes:
Impact: Eliminates redundant GPU operations during hover/selection 7. src/ui/main-window/ThumbnailTitleView.swift (+30 lines)Purpose: Constraint optimization (existing, kept from previous fixes) Key Changes:
Impact: 90% reduction in constraint operations 8. src/ui/main-window/PreviewPanel.swift (+23 lines)Purpose: Preview frame caching (existing, kept from previous fixes) Key Changes:
Impact: Skips expensive window repositioning when preview unchanged 9. scripts/install_local_build.sh (NEW FILE, +95 lines)Purpose: Local development build installation script Features:
Impact: Faster development workflow 10. scripts/build_app.sh (+55 lines)Purpose: Improved build script with launch capability Features:
Impact: One-command build-and-test workflow 11. alt-tab-macos.xcodeproj/project.pbxproj (+20 lines)Purpose: Xcode project configuration Key Changes:
Impact: PerfLogger included in builds 12. src/logic/SystemPermissions.swift (+12 lines)Purpose: Minor logging additions Changes:
Impact: Better diagnostics 13. src/api-wrappers/CGWindow.swift (-20 lines)Purpose: Code cleanup Changes:
Impact: Cleaner codebase 14. src/logic/Applications.swift (-20 lines)Purpose: Code cleanup Changes:
Impact: Cleaner codebase 📊 PERFORMANCE RESULTSBefore Fix
After Fix
Metrics
🔍 WHAT'S NOT INCLUDED (Future Work)The following untracked documentation files are NOT staged:
Reason: These are internal investigation/planning documents. The actual code changes contain sufficient inline documentation. ✅ TESTING VERIFICATIONTest Scenarios Passed
Performance Logging Verification# Debug build - logging enabled
tail -f /tmp/alttab_perf.log
# Release build - zero logging overhead (compilation flag)
# No log file created, no NSLog calls🚀 COMMIT READINESSChecklist
Recommended Commit MessageFix: Eliminate 2-9s hang during rapid Tab cycling on macOS 15.2 Root Cause: Solution:
Results:
Related optimizations kept from previous investigation:
Testing:
Fixes: #5177 (macOS 15.2 hang bug) 📝 NOTES FOR REVIEWER
|
|
I'll go back through and add a cleaner system for the performance stuff so we're not holding onto all those timing vars. |
|
Actually, lemme make this 3 separate PRs that build on each other to make life easier for you:
This is a true measurement of the next PR. |
References:
#5177