Skip to content

perf(extensions): reuse on-demand build stamps#606

Closed
JustYannicc wants to merge 121 commits into
SuperCmdLabs:mainfrom
JustYannicc:codex/perf-extensions-on-demand-build-stamps-20260705
Closed

perf(extensions): reuse on-demand build stamps#606
JustYannicc wants to merge 121 commits into
SuperCmdLabs:mainfrom
JustYannicc:codex/perf-extensions-on-demand-build-stamps-20260705

Conversation

@JustYannicc

Copy link
Copy Markdown
Collaborator

What changed

  • Shared extension build input/options creation between full extension builds and on-demand single-command builds.
  • On successful on-demand builds, write a .sc-build-stamp.json command entry with the same input/output signature shape used by buildAllCommands.
  • Merge existing command stamps only when the extension-level build context still matches, then replace the on-demand command stamp with the fresh signature.
  • Extended the multi-command build harness with an on-demand single build followed by a full build reuse case.

Why

  • Wave 4 stamps let full builds reuse unchanged bundles, but on-demand buildSingleCommand did not write a stamp.
  • A command built on demand could be rebuilt by the next full build even when source and config were unchanged.

Compatibility impact

  • Preserves Raycast-compatible externals, native scheme handling, tsconfig handling, dependency installation fallback, missing-source behavior, and full rebuild recovery paths.
  • No manifest or runtime API changes.

How tested

  • node scripts/test-extension-runner-multi-command-build.mjs
  • SUPERCMD_EXTENSION_BUILD_MEASURE=1 node scripts/test-extension-runner-multi-command-build.mjs
  • node scripts/test-extension-bundle-cache.mjs
  • node scripts/measure-extension-bundle-cache.mjs
  • ./node_modules/.bin/tsc -p tsconfig.main.json --noEmit --pretty false
  • Codex LSP diagnostics for src/main/extension-runner.ts: no diagnostics found.

Performance evidence

  • New harness scenario on-demand-single-then-full-build: on-demand build esbuild entries [command-0]; follow-up full build esbuild entries [command-1, command-2]`, proving the on-demand-stamped command was reused instead of rebuilt.
  • Representative measured run: single 15.06ms, follow-up full 13.53ms; esbuild call durations 13.57ms for command-0 and 12.63ms for command-1/command-2.
  • Existing repeated full-build measurement remains one esbuild call per fixture after warm reuse: command counts 1/5/20 reported timings [13.82, 0.33, 0.2], [17.85, 0.58, 0.51], [18.86, 1.71, 1.81] with esbuildCalls: 1.

Stack validation

  • Started from codex/perf-wave4-integrated-stack-20260705 exact SHA ac90ce403aeddab98d0a1b245afce268c48b8bfd; branch now descends from that SHA.
  • Branch: codex/perf-extensions-on-demand-build-stamps-20260705.
  • Used a temporary sibling node_modules symlink for checks because this worktree had no dependencies; removed it before commit.

Replaces

  • Addresses the Wave 5 audit finding that on-demand extension command builds did not merge/write reusable build stamps.

(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 the consolidated runtime/lifecycle/media PR: #622

@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