Skip to content

perf(menubar): reuse serialized items for title ticks - #616

Closed
JustYannicc wants to merge 121 commits into
SuperCmdLabs:mainfrom
JustYannicc:codex/perf-menubar-renderer-serialize-cache-20260705
Closed

perf(menubar): reuse serialized items for title ticks#616
JustYannicc wants to merge 121 commits into
SuperCmdLabs:mainfrom
JustYannicc:codex/perf-menubar-renderer-serialize-cache-20260705

Conversation

@JustYannicc

Copy link
Copy Markdown
Collaborator

What changed

  • Reuse the renderer's serialized MenuBarExtra item payload and action map when the registry version and assets path are unchanged.
  • Keep tray title, tooltip, and tray icon updates flowing while avoiding stable menu item walks and icon serialization.
  • Cache the visible-payload item hash when the serialized item array identity is stable.
  • Add focused regression coverage for title-only ticks, handler-only registry updates, and item-hash reuse.

Why

Title-only menu-bar ticks were still sorting and serializing the full registered item tree, resolving every item and alternate icon, and hashing the full item payload before discovering that only tray-visible fields changed.

Compatibility impact

Registry, handler, submenu, alternate, section, disabled-label, icon, and extension-context behavior is preserved. Registry version or assets-path changes invalidate the item/action cache, and actions are still installed before unchanged visible payloads are skipped.

How tested

  • node --test scripts/test-menubar-payload-cache.mjs scripts/test-menubar-renderer-serialization-cache.mjs
  • node scripts/run-node-tests.mjs --exclude-perf
  • PATH=/opt/homebrew/lib/node_modules/npm/bin:$PATH node /opt/homebrew/lib/node_modules/npm/bin/npm-cli.js run typecheck:renderer
  • PATH=/opt/homebrew/lib/node_modules/npm/bin:$PATH node /opt/homebrew/lib/node_modules/npm/bin/npm-cli.js run build:renderer
  • Codex LSP diagnostics on menubar-runtime-parent.tsx and menubar-runtime-payload-cache.ts: no errors

Performance evidence

Actual-module baseline before edits, 60 stable items with 12 alternates over 120 title ticks: 7,200 item serializer entries, 8,640 item icon payload calls, 120 tray icon payload calls, 120 IPC sends, 148.81 ms in the timer-based harness.

After edits with the same timer-based harness: 0 item serializer entries, 0 item icon payload calls, 120 tray icon payload calls, 120 IPC sends, 155.35 ms. That wall-clock sample is timer-harness dominated, so I also ran a direct syncMenuBar-awaited comparison in the same process: cache-disabled shape 14.61 ms vs current cache 4.25 ms for the same 120 ticks, with item icon calls dropping from 8,640 to 0.

Stack validation

Started from required branch state codex/perf-wave4-integrated-stack-20260705 at ac90ce403aeddab98d0a1b245afce268c48b8bfd. Implementation branch is codex/perf-menubar-renderer-serialize-cache-20260705, commit 51242473dd126f4d9a8cbd84bfa6a1b99b9f81fb.

Replaces

No previous PR. This replaces the parent audit's synthetic renderer serialization-cache model with measured actual-module behavior and regression coverage.

(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