perf(icons): cache local asset existence checks#484
Closed
JustYannicc wants to merge 1 commit into
Closed
Conversation
Collaborator
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What Changed
icon-runtime-assets.tsx.resolveIconSrcthat stubswindow.electron.statSyncand covers extension-relative assets,sc-asset://URLs, absolute paths, missing assets, configuredassetsPath, and the repeated-resolution measurement.Why
resolveIconSrcwas callingwindow.electron.statSyncsynchronously every time a local icon or asset source was normalized. List rows, grid cells, and action overlays can all hit this path repeatedly, so resolving the same known-good asset caused repeated sync renderer-to-main IPC/stat work.Compatibility Impact
sc-asset://ext-assetURL formatting and local path resolution are unchanged.sc-asset://URL until the cache is cleared; this matches the accepted positive-only caching tradeoff for stable extension asset paths.Metrics
Baseline before code changes, 10,000 resolves of the same stubbed local asset path:
After change, same 10,000-resolve measurement with a fresh module per case:
The checked-in focused test also reports:
iterations=10000 statSync=1 elapsedMs=14.997.Checks
node --test scripts/test-icon-asset-cache.mjspnpm test— 30 passed, 1 skipped live Electron testpnpm build:rendererpnpm check:i18n— command exited 0; reported existing missing Italian keyssettings.ai.whisper.vocabularyandsettings.extensions.appSearchScopesrc/renderer/src/raycast-api/icon-runtime-assets.tsx— no errorsNotes / Risks
src/renderer/src/raycast-apistill reports unrelated pre-existing TypeScript diagnostics incontext-scope-runtime.tsandhooks/use-cached-promise.ts.pnpm buildwas not run because this change is renderer-only and the full build compiles native Swift/addon artifacts;pnpm build:rendererwas run for the touched surface.