Skip to content

perf(renderer): lazy-load locale catalogs#581

Closed
JustYannicc wants to merge 115 commits into
SuperCmdLabs:mainfrom
JustYannicc:codex/perf-wave4-renderer-locale-payload-20260704
Closed

perf(renderer): lazy-load locale catalogs#581
JustYannicc wants to merge 115 commits into
SuperCmdLabs:mainfrom
JustYannicc:codex/perf-wave4-renderer-locale-payload-20260704

Conversation

@JustYannicc

Copy link
Copy Markdown
Collaborator

What changed

  • Lazy-load non-English renderer i18n catalogs while keeping English loaded as the synchronous fallback.
  • Refresh the i18n provider when the selected catalog finishes loading so system/settings language changes still update translated roots.
  • Add a focused Node test for async locale loading, unloaded-locale fallback, and interpolation.

Why

  • src/renderer/src/i18n/runtime.ts previously statically imported all 10 locale JSON files, about 564,181 raw bytes. Because src/renderer/src/main.tsx wraps every root in I18nProvider, that payload was on the renderer startup path.

Compatibility impact

  • No language options were removed.
  • t() remains synchronous for existing callers. Non-English locales render through English fallback until their catalog loads, then rerender with the selected locale.
  • System locale resolution, settings language switching, interpolation, English fallback, and development missing-key warnings remain in place.

How tested

  • npm run build:renderer before and after
  • node scripts/measure-renderer-bundle.mjs before and after
  • node --test scripts/test-i18n-locale-loading.mjs
  • npm run typecheck:renderer
  • node scripts/test-renderer-lazy-route-imports.mjs
  • npm run check:i18n
  • Codex LSP diagnostics on src/renderer/src/i18n/runtime.ts and src/renderer/src/i18n/I18nProvider.tsx

Performance evidence

  • Locale JSON raw input: 564,181 bytes across src/renderer/src/i18n/locales/*.json.
  • Before: startup assets assets/index-nS7cyLJ-.js, assets/index-xOT1lIno.css; startup total 701,309 bytes / 211,722 gzip; startup JS assets/index-nS7cyLJ-.js 573,392 bytes / 188,879 gzip.
  • After: startup assets assets/index-C-dN1Bmt.js, assets/index-xOT1lIno.css; startup total 320,954 bytes / 86,500 gzip; startup JS assets/index-C-dN1Bmt.js 193,037 bytes / 63,657 gzip.
  • Delta: startup total down 380,355 bytes raw and 125,222 bytes gzip. Non-English locale catalogs now emit as separate async chunks such as de-B3j8dt2o.js, fr-HVS2WvMZ.js, ja-Mxew1MvC.js, and zh-Hans--qsviTFn.js.

Stack validation

  • Started from codex/perf-wave3-integration-stack-20260704 at 206eab8280a2eb91a57e4e74ea6df99e45a55cb4.
  • Branch: codex/perf-wave4-renderer-locale-payload-20260704.
  • No coordinator notes, playbooks, prompts, or generated lockfiles are included.

Replaces

  • None.

…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