Skip to content

perf(icons): cache main icon IPC lookups - #536

Closed
JustYannicc wants to merge 1 commit into
SuperCmdLabs:mainfrom
JustYannicc:codex/perf-main-icon-ipc-cache-pr
Closed

perf(icons): cache main icon IPC lookups#536
JustYannicc wants to merge 1 commit into
SuperCmdLabs:mainfrom
JustYannicc:codex/perf-main-icon-ipc-cache-pr

Conversation

@JustYannicc

Copy link
Copy Markdown
Collaborator

What changed

  • Added bounded main-process LRU caches with in-flight request coalescing for file and app icon data URL lookups.
  • Reused the app icon cache for the existing sync menu-item app icon lookup.
  • Added a focused harness that stubs native icon providers and captures before/after native-call counts.

Why

Renderer call sites outside the Raycast runtime can repeatedly ask the main process for the same icons. File icons currently hit app.getFileIcon every time, while app icon data URLs shell out through the .app icon resolver. Caching successful data URLs and coalescing identical in-flight requests avoids duplicate native work without changing renderer APIs.

Compatibility impact

  • IPC channel names, arguments, and return shapes are unchanged.
  • Successful data URLs are cached in bounded LRU maps.
  • Null/error results are not permanently cached, so late-available icons can still recover.

How tested

  • node scripts/test-main-icon-ipc-cache.mjs
    • File icons, 100 concurrent requests: before 100 native calls, after 1.
    • File icons, 100 repeated requests: before 100 native calls, after 1.
    • App icons, 100 concurrent requests: before 100 native calls, after 1.
    • App icons, 100 repeated requests: before 100 native calls, after 1.
  • ./node_modules/.bin/tsc -p tsconfig.main.json --noEmit --pretty false
  • LSP diagnostics for src/main/main.ts and src/main/icon-ipc-cache.ts
  • git diff --check

Stack validation

Clean PR branch from origin/main; cherry-picked only the scoped main icon IPC cache fix. No integration-stack commits are included.

@JustYannicc

Copy link
Copy Markdown
Collaborator Author

Superseded by consolidated runtime lifecycle/icon churn PR #558: #558

@JustYannicc JustYannicc closed this Jul 3, 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