Skip to content

Conversation

@ibetitsmike
Copy link
Contributor

Summary

Implements performance optimizations from the Electron guide-based analysis. Focus areas:

Build/Packaging (C1-C3)

  • Sourcemap gating: Production builds no longer include renderer sourcemaps (opt-in via MUX_RENDERER_SOURCEMAPS=1)
  • Clean dist structure: Renderer output isolated to dist/renderer/ with emptyOutDir: true to prevent stale asset accumulation
  • Chunk splitting: Mermaid (~2.3MB) and ghostty-web (~634KB) split into on-demand chunks loaded only when needed

Renderer Hot Paths (B1-B2, B5)

  • O(n) bash grouping: Precompute bash output group boundaries once per message list instead of O(n²) per-render computation
  • Lazy Mermaid: Defer rendering until visible via IntersectionObserver + cache rendered SVGs
  • Dynamic imports: Mermaid and ghostty-web loaded on-demand to reduce initial bundle parse/execute time
  • Adaptive polling: useResumeManager now uses 1s interval when workspaces need attention, 5s when idle

Testing

  • make typecheck
  • Existing unit tests pass (messageUtils, Mermaid)
  • Build produces correct structure with chunked deps

Not Included (future follow-ups)

  • B3: Review panel virtualization (needs @tanstack/react-virtual + more complex changes)
  • B4: Persisted-state fan-out optimization (would require lifting state to parent)

Generated with mux • Model: anthropic:claude-opus-4-5 • Thinking: high

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Build/packaging (C1-C3):
- Gate sourcemaps off in production (opt-in via MUX_RENDERER_SOURCEMAPS=1)
- Move renderer output to dist/renderer/ with emptyOutDir:true for clean builds
- Split mermaid (~2.3MB) and ghostty-web (~634KB) into on-demand chunks

Renderer hot paths (B1-B2, B5):
- Precompute bash output group boundaries in O(n) instead of O(n²)
- Defer Mermaid rendering until visible (IntersectionObserver) + SVG cache
- Dynamic import for mermaid and ghostty-web (lazy load large deps)
- Adaptive polling in useResumeManager (1s when active, 5s when idle)

Validation:
- make typecheck passes
- Existing tests pass
- Build produces correct dist/ structure with chunked deps
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