HERMES-GIELIE/static
Basit Mustafa a4b56642d9
perf(streaming): throttle inflight localStorage persist to prevent GC crash (#972)
saveInflightState() is called from syncInflightAssistantMessage() on every
token. It does localStorage.getItem + JSON.parse + mutate + JSON.stringify +
localStorage.setItem on the full inflight state map. For a 5000-token response
with a 10KB messages array this produces ~36MB of JSON churn per second.

This O(response_length) work per token is the primary source of GC pressure
that causes the renderer to crash (Chrome error codes 4/5). The 13.6-second
RunTask we observed in perf traces is a direct consequence: accumulated rAF
callbacks execute all at once after each multi-second GC pause.

Fix: add _throttledPersist() which writes at most once every 2 seconds during
token streaming. State transitions that matter for crash recovery (tool events,
done, start) still call persistInflightState() directly, so at most 2s of
in-flight progress is lost if the tab crashes mid-stream.

The _persistTimer is cleared on 'done' so the final state is always flushed.

Co-authored with Claude Sonnet 4.6 / Anthropic.
2026-04-24 12:33:16 -07:00
..
vendor chore: vendor streaming-markdown@0.2.15, remove CDN dependency 2026-04-24 01:05:20 +00:00
boot.js refactor(ui): three-column layout with left rail + main-view migration (#899) 2026-04-24 09:05:25 -07:00
commands.js v0.50.185: /btw stream hardening + .venv bootstrap + /reasoning toast (#935 #939 #941 #942) 2026-04-23 23:25:45 -07:00
favicon-32.png fix: add favicon (SVG + PNG + ICO), fix static MIME types (#613) 2026-04-16 20:11:02 -07:00
favicon.ico fix: add favicon (SVG + PNG + ICO), fix static MIME types (#613) 2026-04-16 20:11:02 -07:00
favicon.svg fix: add favicon (SVG + PNG + ICO), fix static MIME types (#613) 2026-04-16 20:11:02 -07:00
i18n.js i18n: add complete Traditional Chinese (zh-Hant) translations (#954) 2026-04-24 11:36:41 -07:00
icons.js refactor(ui): three-column layout with left rail + main-view migration (#899) 2026-04-24 09:05:25 -07:00
index.html i18n: add complete Traditional Chinese (zh-Hant) translations (#954) 2026-04-24 11:36:41 -07:00
login.js feat: support subpath mount via reverse proxy — v0.50.67 (PR #588 by @vcavichini) 2026-04-16 11:20:08 -07:00
manifest.json feat: add PWA support (manifest, service worker, install prompt) (#920) 2026-04-23 15:14:21 -07:00
messages.js perf(streaming): throttle inflight localStorage persist to prevent GC crash (#972) 2026-04-24 12:33:16 -07:00
onboarding.js fix(config): use Hermes config.yaml as single source of default model (#773) 2026-04-20 22:12:01 +00:00
panels.js refactor(ui): three-column layout with left rail + main-view migration (#899) 2026-04-24 09:05:25 -07:00
sessions.js i18n: add complete Traditional Chinese (zh-Hant) translations (#954) 2026-04-24 11:36:41 -07:00
style.css fix(ui): close 641-767px rail/hamburger breakpoint gap (#956) 2026-04-24 09:13:00 -07:00
sw.js feat: add PWA support (manifest, service worker, install prompt) (#920) 2026-04-23 15:14:21 -07:00
ui.js perf(ui): cache renderMessages per session, skip O(n) rebuild on back-navigation (#963) 2026-04-24 11:49:14 -07:00
workspace.js feat: support subpath mount via reverse proxy — v0.50.67 (PR #588 by @vcavichini) 2026-04-16 11:20:08 -07:00