Reduce CPU use and main-thread IPCs in bar updates, app switching and polling
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 15/100
- Tipo di issue
- Refactoring
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- macos, swift
- Ambito
- desktop, performance
Direzione di ricerca
Start by reviewing the linked pull request #996 and the issue’s proposed hot-path changes. The work spans many components, including BarPresentation, WindowClearance, MenuBarItemMirror, Spaces, QuickToggles, and AudioMonitor; follow the relevant paths and tests from there. Done means reducing the listed redundant work and IPCs without changing user-facing behavior or configuration format.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Problem
Several hot paths in StableBar do redundant work or synchronous IPCs on @MainActor:
BarPresentation.updatePresentations()re-walksconfiguration.needsModeConnection, rebuilds per-screen widget lookups and re-resolves every widget's style across every screen whenever any single script or provider updates.WidgetConfiguration.label(output:activeApp:date:)allocates a newDateFormatterand recompiles three ICU patterns on every clock render.HexColor.colorallocates a fresh dynamicNSColorclosure on every SwiftUIbodypass, defeatingColor == Colordiffing, andStyledShadowruns a shadow pass even when no shadow color is set.WindowClearancere-registersAXObserverAddNotificationand schedules all running apps on every activation/unhide, making 5 sequential AX IPCs per window on@MainActor.MenuBarItemMirrorruns cropping and per-pixel array-allocating image processing on@MainActorevery 2 seconds.Spaces.currentSpaces()queriesSLSCopySpacesForWindowsfor all windows before filtering to layer-0 regular apps and round-trips through binary plist serialization.QuickTogglesreads fullAudioMonitor(input: true).read()(~30+ CoreAudio IPCs) every second while open just for mic mute, duplicatesSCDynamicStoreIPv4 and Finder preference syncs, and writesbluetoothAccessunconditionally.MenuBarStrip,BarView,MenuBarAppearance,WorkspaceStore,DockBadges,NativeMetrics,AppMenuandConfigurationLoaderperform avoidable main-thread work or unconditional@Observablewrites.
Proposal
Optimize these hot paths without changing any user-facing behavior or configuration format:
- Precompute static
BarPresentationmetadata and run incremental per-script updates (falling back to a full pass when cross-widgetwidgetStyles,barStyleor mode-state demand changes). - Cache clock
DateFormatters (invalidated on locale/timezone changes) and adaptiveHexColorNSColorinstances; skip uncolored shadow passes while keeping zero-radius hard shadows. - Batch
WindowClearancewindow attributes into oneAXUIElementCopyMultipleAttributeValuesIPC, scope activation/unhide to the activated app, and retry notification registration only until it succeeds. - Move
MenuBarItemMirrorcropping/pixel work off@MainActorwith zero-allocation pixel loops, filterSpaceswindows before SkyLight IPCs, addAudioMonitor.isMuted(input:), and guard no-op@Observable/@Statewrites.
Possible today
None of these are configurable; they happen automatically in normal use.
Related
Continues earlier performance work in #161, #174, #246, #353 and #377.
Triaged by Antigravity (Gemini 4 Neon).
- Lingua principale
- Swift
- Stelle
- 184
- Fork
- 12
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di Seb-GRAF/StableBar
-
A second click on the Control Center widget doesn't close Control CenterForse già presa @MaHofseth l’ha presa oggi. Apertaneeds-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
-
enhancement P3
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
-
enhancement P3
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
-
enhancement P3
Difficoltà 5/5 Più di una settimana Idoneità per principianti 42/100
-
enhancement P3
Difficoltà 4/5 3-5 giorni Idoneità per principianti 53/100
Tutte le issue di Seb-GRAF/StableBar
Issue simili
-
area: models enhancement needs-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
rexmhall09/TUFF#69 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
nikitabobko/AeroSpace#2427 · 1 commento ·
I maintainer di solito rispondono entro 8 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 63/100
I maintainer di solito rispondono entro 1 giorno
-
README: privacy statementApertadocumentation good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
-
android bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
I maintainer di solito rispondono entro 1 giorno