hermes-agent/apps/desktop/src
Brooklyn Nicholson ea510a7c02 perf(desktop): memoize MarkdownText plugins to stop churning Streamdown
The inline `plugins={{ math: mathPlugin, ...(isStreaming ? {} : { code }) }}`
on `<StreamdownTextPrimitive>` constructed a new object literal on every
parent render. That broke `<Streamdown>`'s outer memo and forced its
internal `rehypePlugins` / `remarkPlugins` array useMemos to rebuild,
which propagates a new identity into every `<Block>` and defeats Block's
memoization for stable historical blocks.

After memoizing on `[isStreaming]` (the only real dimension of variance),
CPU profile during a 5 s synthetic stream on the 34 MB session shows
`parser` self-time dropping out of the top 10, `compile` cut roughly in
half, and `bn$1` / `m$1` (micromark internals) leaving the top entries.

Doesn't move the visible longtask count on its own — Streamdown's
per-Block parse cost still dominates whenever the last block's content
changes — but it removes a class of unnecessary re-parses for historical
blocks during streaming. See `scripts/profile-typing-lag.md` for the
full investigation.
2026-05-21 20:08:32 -05:00
..
app chore(desktop): synthetic-stream perf harness + scripts 2026-05-21 19:38:26 -05:00
components perf(desktop): memoize MarkdownText plugins to stop churning Streamdown 2026-05-21 20:08:32 -05:00
hooks feat: glass ui pass 2026-05-16 19:21:33 -05:00
lib feat: more ui qa 2026-05-16 21:26:50 -05:00
store feat: more ui qa 2026-05-16 21:26:50 -05:00
themes feat: more ui qa 2026-05-16 21:26:50 -05:00
types feat: glass ui pass 2026-05-16 19:21:33 -05:00
global.d.ts feat(desktop): thin installer + first-launch install.ps1 bootstrap 2026-05-18 02:26:46 -04:00
hermes.ts feat: more ui qa 2026-05-16 21:26:50 -05:00
main.tsx chore(desktop): synthetic-stream perf harness + scripts 2026-05-21 19:38:26 -05:00
styles.css feat: more ui qa 2026-05-16 21:26:50 -05:00
vite-env.d.ts feat(desktop): add structured desktop chat app 2026-05-01 12:49:12 -05:00