Reduce CPU use and main-thread IPCs in bar updates, app switching and polling
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 15/100
- issue の種類
- リファクタリング
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- macos, swift
- 領域
- desktop, performance
調査の方向性
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.
索引モデルが issue の本文から書いたものです。
説明
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).
- 主要言語
- Swift
- スター
- 184
- フォーク
- 12
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
Seb-GRAF/StableBar のほかの issue
-
A second click on the Control Center widget doesn't close Control Center対応中かも @MaHofseth が今日担当しました。 オープンneeds-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
-
enhancement P3
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
-
enhancement P3
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
-
enhancement P3
難易度 5/5 1週間以上 初心者へのやさしさ 42/100
-
enhancement P3
難易度 4/5 3〜5日 初心者へのやさしさ 53/100
Seb-GRAF/StableBar の issue をすべて見る
似ている issue
-
area: models enhancement needs-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
rexmhall09/TUFF#69 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
nikitabobko/AeroSpace#2427 · コメント 1 件 ·
メンテナーはふだん 8 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 63/100
メンテナーはふだん 1 日以内に返信
-
documentation good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
-
android bug
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
メンテナーはふだん 1 日以内に返信