Skip to content

Fix memory leak, reduce I/O, parallelize extensions, add code splitting + mimalloc + LTO#532

Merged
mehmetozguldev merged 3 commits into
athasdev:masterfrom
visualstudioblyat:perf/six-verified-fixes
Feb 18, 2026
Merged

Fix memory leak, reduce I/O, parallelize extensions, add code splitting + mimalloc + LTO#532
mehmetozguldev merged 3 commits into
athasdev:masterfrom
visualstudioblyat:perf/six-verified-fixes

Conversation

@visualstudioblyat
Copy link
Copy Markdown
Contributor

what this does

6 performance fixes, all verified against the actual codebase. no speculative stuff.

memory leaklastBufferContent and historyDebounceTimers in app-store are module-level Maps that grow every time a buffer opens but never shrink when it closes. added a cleanup function that gets called in closeBufferForce.

debounce disk writessaveSessionToStore gets called 6 different places across buffer operations. closing 10 tabs = 10 synchronous writes. wrapped it in a 300ms debounce so it batches into 1.

parallel extension loading — extensions were loading in a sequential for...await loop. switched to Promise.allSettled so they all load at once. one failing extension no longer blocks the rest either.

code splitting — 9 heavy components in pane-container (terminal, sqlite viewer, diff viewer, PR viewer, image/pdf/web viewer, agent tab, external editor) and UpdateDialog in App.tsx were eagerly imported. converted to React.lazy + Suspense so they only load when actually needed.

mimalloc — added as global allocator. the default Windows heap is slow for the small frequent allocations rust does. mimalloc is purpose-built for this.

LTO + codegen-units — added lto="thin" and codegen-units=1 to release profile. lets LLVM optimize across crate boundaries and produce tighter binaries.

files changed

  • src/stores/app-store.ts — export cleanup function for buffer history tracking
  • src/features/editor/stores/buffer-store.ts — debounce wrapper + cleanup call on close
  • src/extensions/loader/extension-loader.ts — Promise.allSettled
  • Cargo.toml — release profile
  • src-tauri/Cargo.toml — mimalloc dep
  • src-tauri/src/main.rs — global allocator
  • src/App.tsx — lazy UpdateDialog
  • src/features/panes/components/pane-container.tsx — lazy 9 components + Suspense

typecheck passes clean.

…ng + mimalloc + LTO

- plug unbounded Map growth in app-store (lastBufferContent/historyDebounceTimers never cleared on buffer close)
- debounce saveSessionToStore so closing 10 tabs = 1 disk write instead of 10
- extensions load in parallel via Promise.allSettled instead of sequential await loop
- lazy-load 9 heavy components (terminal, sqlite viewer, diff viewer, PR viewer, image/pdf/web viewer, agent tab, external editor) + UpdateDialog
- add mimalloc as global allocator (~2x faster small allocs vs default Windows heap)
- add lto="thin" + codegen-units=1 for release builds (~5-8% runtime gain)
@mehmetozguldev mehmetozguldev self-requested a review February 18, 2026 14:38
@mehmetozguldev mehmetozguldev changed the title fix memory leak, reduce I/O, parallelize extensions, add code splitting + mimalloc + LTO Fix memory leak, reduce I/O, parallelize extensions, add code splitting + mimalloc + LTO Feb 18, 2026
Copy link
Copy Markdown
Member

@mehmetozguldev mehmetozguldev left a comment

Choose a reason for hiding this comment

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

Reviewed and verified locally after the latest update. CI formatting issues are fixed, and the performance-focused changes look good to merge.

@mehmetozguldev mehmetozguldev merged commit 2452306 into athasdev:master Feb 18, 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.

2 participants