Skip to content

perf(menubar): skip unchanged file icon image updates - #610

Closed
JustYannicc wants to merge 121 commits into
SuperCmdLabs:mainfrom
JustYannicc:codex/perf-menubar-file-icon-identity-20260705
Closed

perf(menubar): skip unchanged file icon image updates#610
JustYannicc wants to merge 121 commits into
SuperCmdLabs:mainfrom
JustYannicc:codex/perf-menubar-file-icon-identity-20260705

Conversation

@JustYannicc

Copy link
Copy Markdown
Collaborator

What changed

  • Added file-backed tray icon identity tracking to the native menubar update cache.
  • The main menubar update handler now stats file-backed icons and skips Tray.setImage when path, mtime, size, template, scale, and fallback inputs are unchanged.
  • Updated focused native-update tests for stable file-backed title ticks, changed file identity, and changed template/scale/fallback inputs.

Why

Title-only MenuBarExtra ticks with stable file-backed icons were still re-resolving the tray icon and calling native Tray.setImage on every accepted payload. The image cache avoided repeat decode work, but the native tray image update still churned unnecessarily.

Compatibility impact

Changed file mtime/size still refreshes the tray image. Missing files are still rechecked so an icon that appears later can replace the fallback. Data URLs, emoji fallback title behavior, fallback package icons, template state, bitmap scale, and Raycast-style accepted payload updates are preserved.

How tested

  • node --test scripts/test-menubar-native-update-cache.mjs
  • node --test scripts/test-menubar-native-image-cache.mjs
  • PATH=/opt/homebrew/Cellar/node@22/22.22.3/bin:$PATH /opt/homebrew/Cellar/node@22/22.22.3/bin/npm run build:main
  • PATH=/opt/homebrew/Cellar/node@22/22.22.3/bin:$PATH /opt/homebrew/Cellar/node@22/22.22.3/bin/npm run check:package-manager
  • Codex LSP: TypeScript server installed; diagnostics clean for src/main/main.ts and src/main/menubar-native-update-cache.ts; references checked for the touched update-cache APIs.

Performance evidence

Focused 60 accepted title ticks with a stable file-backed tray icon:

  • Before: resolveTrayIcon=60, setImage=59, statSync=60, createFromPath=1, resize=1, setTemplateImage=1.
  • After: resolveTrayIcon=1, setImage=0, statSync=61, createFromPath=1, resize=1, setTemplateImage=1.

The optimization removes 59 native tray image updates and 59 tray icon resolve calls for the stable-title-tick case. Stat work remains intentionally present for file identity checks; the extra post-change stat is the tray creation resolve path confirming the same cache identity.

Stack validation

Started from codex/perf-wave4-integrated-stack-20260705 at ac90ce403aeddab98d0a1b245afce268c48b8bfd, then created codex/perf-menubar-file-icon-identity-20260705. PR target is SuperCmdLabs/SuperCmd:main from JustYannicc:codex/perf-menubar-file-icon-identity-20260705.

Replaces

Source delegation thread: 019f2fd8-c966-7622-9750-1585cf96d402.

(cherry picked from commit 83c2a89)
(cherry picked from commit 0a7560b)
# Conflicts:
#	src/renderer/src/raycast-api/hooks/use-cached-promise.ts
…launcher surfaces

# Conflicts:
#	src/renderer/src/raycast-api/list-runtime-renderers.tsx
#	src/renderer/src/raycast-api/list-runtime.tsx
…IO stalls

# Conflicts:
#	src/renderer/src/CameraExtension.tsx
# Conflicts:
#	src/renderer/src/raycast-api/list-runtime.tsx
…resh overhead

# Conflicts:
#	scripts/bench-script-command-discovery.mjs
#	scripts/benchmark-file-search-delete-batch.mjs
#	scripts/lib/script-command-runner-harness.mjs
#	scripts/lib/ts-import.mjs
#	scripts/test-file-search-delete-batch.mjs
#	scripts/test-script-command-runner.mjs
#	src/main/file-search-index.ts
#	src/main/main.ts
…hurn

# Conflicts:
#	scripts/lib/script-command-runner-harness.mjs
#	scripts/lib/ts-import.mjs
#	scripts/test-extension-lifecycle-sandbox.mjs
#	scripts/test-script-command-runner.mjs
#	src/main/main.ts
#	src/renderer/src/ExtensionView.tsx
… hot paths

# Conflicts:
#	scripts/test-use-frecency-sorting.mjs
#	src/renderer/src/raycast-api/form-runtime.tsx
#	src/renderer/src/raycast-api/grid-runtime-hooks.ts
#	src/renderer/src/raycast-api/grid-runtime-items.tsx
#	src/renderer/src/raycast-api/hooks/use-frecency-sorting.ts
# Conflicts:
#	.github/workflows/project-checks.yml
#	package.json
#	scripts/file-search-perf-harness.mjs
#	scripts/test-browser-search-performance.mjs
#	scripts/test-file-search-perf-harness.mjs
#	scripts/test-root-search-perf.mjs
#	src/renderer/src/CameraExtension.tsx
#	src/renderer/src/hooks/useBrowserSearch.ts
#	src/renderer/src/raycast-api/list-runtime.tsx
…cle and media fixes

# Conflicts:
#	scripts/lib/ts-import.mjs
#	scripts/measure-extension-bundle-cache.mjs
#	src/main/commands.ts
#	src/main/extension-runner.ts
#	src/main/main.ts
#	src/renderer/src/ExtensionView.tsx
#	src/renderer/src/raycast-api/grid-runtime-hooks.ts
#	src/renderer/src/raycast-api/list-runtime-hooks.ts
@JustYannicc

Copy link
Copy Markdown
Collaborator Author

Superseded by consolidated renderer/Raycast wave5 PR #621: #621

@JustYannicc JustYannicc closed this Jul 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant