perf(icons): coalesce file icon IPC#526
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
getFileIconDataUrlcall.fileIconCachewith a 1024-entry LRU cache for successful data URLs and resolved null fallbacks.node:testharness for concurrent duplicate icons, rejection recovery, LRU eviction, and non-file image icon behavior.Why
The file icon runtime lived on a hot render path for Raycast list/grid items. Before this change, duplicate mounted file icons could all observe a cache miss before the first IPC call resolved, so identical icons fanned out into repeated
getFileIconDataUrlIPC calls. The cache was also a module-levelMapwith no cap, so browsing or rendering many unique paths retained every icon result for the life of the renderer.Baseline mock-render harness for the pre-fix request/cache logic reported
sameMountedIcons=100,sameIpcCalls=100,uniqueMountedIcons=5000,uniqueIpcCalls=5000, anduniqueCacheEntries=5000.Compatibility impact
Raycast icon rendering semantics are preserved. File icons still render the same data URL image when available, and still fall back to the existing document/folder glyph while loading or after unavailable icons. Cached file icons may remain stale, matching the existing tolerance. Non-file icon paths continue through the existing remote/image/Phosphor handling. No user-facing strings or locale files changed.
How tested
node -e <mock old FileIcon request/cache harness>->{"sameMountedIcons":100,"sameIpcCalls":100,"uniqueMountedIcons":5000,"uniqueIpcCalls":5000,"uniqueCacheEntries":5000}.node --test scripts/test-icon-runtime-file-icon-cache.mjs-> pass; asserts 100 concurrent identical mounts call IPC once, rejected IPC retries later, 5,000 unique paths stay capped at 1,024 cache entries with LRU eviction, and non-file image icons do not call file icon IPC.git diff --check origin/main...HEAD-> pass.origin/mainbranch:./node_modules/.bin/tsc -p tsconfig.renderer.json --noEmitwas attempted and is blocked by existing unrelatedorigin/mainerrors, includingsrc/renderer/src/App.tsx,src/renderer/src/CameraExtension.tsx,src/renderer/src/components/LiquidGlassSurface.tsx, and other pre-existing renderer type issues outside this PR diff.Stack validation
The runtime fix was developed and validated from
codex/perf-integration-stack, which contains the active performance stack. Before creating this scopedorigin/mainPR branch, the stack-based worker branch passed:node --test scripts/test-icon-runtime-file-icon-cache.mjsnode --test scripts/test-icon-asset-cache.mjs scripts/test-icon-runtime-phosphor-cache.mjs./node_modules/.bin/tsc -p tsconfig.renderer.json --noEmitgit diff --checkThe upstream PR branch
codex/perf-file-icon-cache-coalesce-prwas created fromorigin/mainand contains only the file-icon runtime/test diff.