Skip to content

perf(raycast): reduce action and dropdown churn - #611

Closed
JustYannicc wants to merge 121 commits into
SuperCmdLabs:mainfrom
JustYannicc:codex/perf-raycast-action-list-registry-churn
Closed

perf(raycast): reduce action and dropdown churn#611
JustYannicc wants to merge 121 commits into
SuperCmdLabs:mainfrom
JustYannicc:codex/perf-raycast-action-list-registry-churn

Conversation

@JustYannicc

Copy link
Copy Markdown
Collaborator

What changed

  • Memoized List.Dropdown child flattening while preserving nested Section/Item walking and initial onChange behavior.
  • Added action registry visible-field signatures for id/order/title/section/icon/shortcut/style so visible changes publish while execute-only callback changes update in place without new action arrays.
  • Kept List, Form, and Detail global keydown listeners attached once and routed them through refs for current actions and shortcut helpers.
  • Added focused node tests with before/after instrumentation for dropdown walks, registry publishes, and listener add/remove churn.

Why

Repeated equivalent renders were rebuilding dropdown item arrays, publishing action arrays for non-visible updates, and reattaching global key listeners when action arrays changed.

Compatibility impact

No Raycast API behavior or extension compatibility changes intended. Nested dropdown sections/items, initial dropdown onChange, Meta-K, custom shortcuts, primary action execution, and focus restoration semantics are preserved. Grid was validated as non-actionable for global keydown listener churn because it does not attach a global keydown listener.

How tested

  • node --test scripts/test-action-registry-listener-churn.mjs scripts/test-list-dropdown-memoization.mjs
  • node --test scripts/test-registry-dirty-checks.mjs scripts/test-list-registry-stable-order.mjs scripts/test-registry-microtask-lifecycle.mjs
  • npm run test:ci
  • node_modules/.bin/vite build
  • LSP diagnostics on changed TSX runtime files: no diagnostics found
  • LSP references for new exported helpers resolved only to intended local/tested uses

Note: npm run typecheck:renderer is blocked on this machine by /Users/justyannicc/.local/bin/npm, which prints "npm is intentionally disabled on this Mac. Using pnpm instead." and trips the repo package-manager parity guard. Direct tsc -p tsconfig.renderer.json --noEmit --pretty false runs but reports pre-existing project-wide renderer Node global type errors for process/Buffer outside this change.

Performance evidence

  • List.Dropdown stable children over 8 renders: child walks 40 before -> 5 after; initial onChange calls 8 before -> 1 after.
  • Action registry repeated equivalent execute-only renders: registry version publishes 12 before -> 0 after; visible style/shortcut/icon updates still publish.
  • Global keydown equivalent action churn over 12 renders: List/Form/Detail addEventListener 12 -> 1 and removeEventListener 11 -> 0; Grid remains 0/0 because it has no global keydown listener.

Stack validation

Started from codex/perf-wave4-integrated-stack-20260705 exact base SHA ac90ce4. Branch codex/perf-raycast-action-list-registry-churn commit c068ae4 builds on that stack.

Replaces

None.

(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