
Nguyễn Ngô ThượngandBohdan Triapitsyn
3cd6d051cb
perf: fix streaming lag, memory leaks, stuck spinners, and proxy timeout (#483)
* perf: fix streaming lag, memory leaks, and proxy timeout
- PERF-001: Batch all streaming parts via requestAnimationFrame instead of
per-token Zustand set() calls (~100/sec → 1 per frame)
- PERF-002: Fix direct state.sessionMemoryState mutation inside set() callback
- PERF-003: Debounce messageStore→sessionStore subscription via rAF + 500ms
title computation delay
- PERF-004: Stabilize SSE callbacks with refs to prevent reconnection storms;
add 5-min stuck session idle timeout
- PERF-005: Bound messageCache (500 max, LRU eviction), cap registry Maps,
cleanup on session eviction
- PERF-006: Replace toast duration: Infinity with 30s + id-based dedup
- Fix proxy timeout: POST /session/:id/message 45s → 4min (matches CLI)
- Add vitest + jsdom test infrastructure (61 tests across 7 files)
Addresses: #476 (stuck spinner), #358 (34GB memory leak), #190 (browser lag)
* perf: virtualize tool output rendering (read, edit, write)
- PERF-007: Replace per-line <SyntaxHighlighter> with VirtualizedCodeBlock:
- ONE Prism.highlight() call for entire file instead of N per-line calls
- @tanstack/react-virtual renders only visible rows (~30 vs 2000+)
- Applied to: ToolPart (read, DiffPreview, WriteInputPreview) and
ToolOutputDialog (unified diff, read content)
- PERF-008: Memoize parseReadToolOutput/parseDiffToUnified via useMemo
to prevent re-parsing on every re-render
A 2000-line file read now mounts ~30 DOM nodes instead of 2000
SyntaxHighlighter instances, eliminating the main-thread blocking
that caused UI freezes during file operations.
* fix: resolve lint errors (unused vars in tests and VirtualizedCodeBlock)
* chore: trim PR scope to core perf fixes
* fix: restore tool-card highlight stability
---------
Co-authored-by: Bohdan Triapitsyn <artmore@protonmail.com>
2026-02-23 12:05:53 +02:00
..
2026-02-21 00:46:15 +02:00
2025-12-07 19:32:53 +02:00
2025-12-07 19:32:53 +02:00
2026-02-09 23:55:10 +02:00
2026-02-17 18:25:03 +02:00
2025-12-07 19:32:53 +02:00
2025-12-07 19:32:53 +02:00
2026-01-27 11:57:56 +02:00
2026-02-23 12:05:53 +02:00
2026-02-05 01:59:49 +02:00
2025-12-07 19:32:53 +02:00
2025-12-07 19:32:53 +02:00
2025-12-07 19:32:53 +02:00
2025-12-25 16:55:37 +02:00
2026-01-26 00:24:40 +02:00
2026-02-23 00:04:25 +02:00
2026-02-09 03:24:25 +02:00
2026-02-20 13:23:01 +02:00
2026-02-09 23:55:10 +02:00
2026-01-03 13:39:59 +02:00
2026-02-04 11:13:23 +02:00
2026-01-23 01:51:22 +02:00
2026-01-22 21:52:22 +02:00
2026-02-05 01:59:49 +02:00
2026-02-09 23:55:10 +02:00
2026-01-20 03:23:39 +02:00
2026-02-16 14:15:19 +02:00
2026-02-13 05:37:28 +02:00
2026-02-05 01:59:49 +02:00
2026-01-03 13:39:59 +02:00
2026-02-05 01:59:49 +02:00
2026-02-09 23:55:10 +02:00