Skip to content

perf(raycast): reduce grid cell selection churn - #592

Closed
JustYannicc wants to merge 115 commits into
SuperCmdLabs:mainfrom
JustYannicc:codex/perf-wave4-raycast-grid-render-churn-20260704
Closed

perf(raycast): reduce grid cell selection churn#592
JustYannicc wants to merge 115 commits into
SuperCmdLabs:mainfrom
JustYannicc:codex/perf-wave4-raycast-grid-render-churn-20260704

Conversation

@JustYannicc

Copy link
Copy Markdown
Collaborator

What changed

  • Added scripts/measure-raycast-grid-render-churn.mjs to measure mixed visible grid cell rendering, rapid selection scroll math, and client-side selection render churn.
  • Hoisted grid-only content/accessory normalization helpers out of GridItemRenderer.
  • Wrapped GridItemRenderer in React.memo with a render-value comparator so rapid selection changes rerender only cells whose visible props change.

Why

Rapid keyboard selection updates recreated per-cell handlers and caused every visible Raycast Grid cell to render each step. The scroll math path was already negligible, so this keeps scroll behavior unchanged and targets the localized cell churn instead.

Compatibility impact

Raycast-visible grid behavior is preserved. Content, accessory, swatch, inset, fit, pointer, mouse-move, activate, and context-menu behavior are unchanged; the memo guard only skips renders when the visible cell inputs are identical.

How tested

  • node scripts/test-grid-virtualization.mjs
  • node scripts/test-emoji-grid-virtualization.mjs
  • node scripts/measure-raycast-grid-render-churn.mjs --iterations=7 --warmups=2 --selection-steps=1200
  • pnpm exec tsc -p tsconfig.renderer.json --noEmit --pretty false
  • ./node_modules/.bin/tsc -p tsconfig.renderer.json --noEmit --pretty false
  • Codex LSP diagnostics on grid-runtime-items.tsx and grid-runtime.tsx: no errors

Performance evidence

Focused benchmark: node scripts/measure-raycast-grid-render-churn.mjs --iterations=7 --warmups=2 --selection-steps=1200.

Before, against the unmodified runtime with the new harness:

Scenario Before
Visible mixed cell render 112 renders, 1.762ms median
Rapid selection scroll math 920 scroll updates, 0.069ms median
Selection render churn 134,400 cell renders, 1,866.622ms median

After this change:

Scenario After
Visible mixed cell render 112 renders, 2.014ms median
Rapid selection scroll math 920 scroll updates, 0.139ms median
Selection render churn 2,400 cell renders, 300.307ms median

The meaningful win is the selection churn path: cell renders dropped about 98.2%, and median churn time dropped about 83.9%. The one-shot visible render and scroll-math paths are essentially unchanged/noisy, so no scroll behavior was changed.

Stack validation

Started from codex/perf-wave3-integration-stack-20260704 at commit 206eab8280a2eb91a57e4e74ea6df99e45a55cb4; this branch is built on that stack without rebasing onto anything else.

Replaces

SuperCmd iterative performance audit wave 4 child implementation: Raycast Grid render churn.

…perf-wave2-integration-stack-20260704

# Conflicts:
#	src/renderer/src/raycast-api/hooks/use-cached-promise.ts
…perf-wave2-integration-stack-20260704

# Conflicts:
#	src/renderer/src/raycast-api/list-runtime-renderers.tsx
#	src/renderer/src/raycast-api/list-runtime.tsx
…perf-wave2-integration-stack-20260704

# Conflicts:
#	src/renderer/src/CameraExtension.tsx
…perf-wave2-integration-stack-20260704

# Conflicts:
#	src/renderer/src/raycast-api/list-runtime.tsx
…perf-wave2-integration-stack-20260704

# 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
…perf-wave2-integration-stack-20260704

# 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
…perf-wave2-integration-stack-20260704

# Conflicts:
#	.github/workflows/project-checks.yml
#	scripts/test-root-search-perf.mjs
#	src/renderer/src/CameraExtension.tsx
#	src/renderer/src/raycast-api/list-runtime.tsx
…erf-wave3-integration-stack-20260704

# Conflicts:
#	package.json
#	scripts/measure-extension-bundle-cache.mjs
#	scripts/test-icon-runtime-file-icon-cache.mjs
#	src/main/extension-runner.ts
#	src/renderer/src/components/HiddenExtensionRunners.tsx
#	src/renderer/src/raycast-api/icon-runtime-render.tsx
…/perf-wave3-integration-stack-20260704

# Conflicts:
#	scripts/test-browser-search-performance.mjs
#	scripts/test-root-search-perf.mjs
@JustYannicc

Copy link
Copy Markdown
Collaborator Author

Superseded by the clean consolidated wave4 renderer/Raycast PR: #599. That branch contains this PR's covered change on current main without the inherited broad-stack noise.

@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