Skip to content

fix(desktop): make render-churn measure streaming, not boot churn - #72212

Merged
OutThisLife merged 1 commit into
mainfrom
bb/desktop-transcript-renders
Jul 26, 2026
Merged

OutThisLife merged 1 commit into
mainfrom
bb/desktop-transcript-renders

Conversation

@OutThisLife

Copy link
Copy Markdown
Contributor

Trust-the-instrument work before the next perf fix. Brooklyn pushed on whether the harness was actually valid given the gateway errors scrolling past every spawn — the errors turned out to be harmless, but checking found the harness itself was not trustworthy.

The measurement was mostly noise

Three back-to-back runs, identical code:

run total_renders wasted_renders commits sidebar
1 19,857 4,192 1,033 6
2 43,294 16,002 646 12
3 20,576 4,639 917 6

2.2x spread on renders, 3.8x on wasted. Wide enough that a single-run before/after delta is as likely to be measuring machine load as a code change.

Cause: the scenario slept a fixed 1s after mounting tabs and then recorded. Session hydration isn't reliably finished by then, so a variable amount of boot work landed inside the window — which is why the bad run's top offenders were Primitive.div and TooltipProvider rather than anything on the streaming path.

Replaced with a quiesce gate: poll the commit counter until it holds still, then record. It reports quiet:N (comparable) or timeout:... (contaminated) so a bad run is visible in the output instead of quietly skewing a number.

The counter was mis-attributing

wasted counted any render with no changed props and no changed hook state — which lumped in context-driven renders. That points at memo() as the fix, and memo() cannot block a context update at all. Adds contextChanged off the fiber's context dependency list and excludes it from wasted.

This immediately disproved my own working theory: Block/Ct come back props=0, state=0, ctx=0, so the streamdown context I suspected is not involved.

The finding that matters more than the fix

With five busy tiles and no driver running, the renderer still commits ~18x/sec. Block/Ct render 800 times while completely idle — more than during the actual streaming window. So the transcript cost I was about to "fix" is substantially an idle-churn problem, not a streaming one.

The report now names cascade roots (own state changed, props did not) instead of leaving them to be guessed:

GlyphSpinner               r=193  state=193
Streamdown                 r=105  state=105   <- parent of Block/Ct
ResponseLoadingIndicator   r= 74  state= 74

Streamdown re-rendering itself 105 times while idle is what drives Block/Ct. That's the next PR — this one just makes it measurable.

No behavior change; instrumentation and harness only.

Two problems, both found by distrusting the harness's own numbers.

1. The scenario slept a fixed 1s after mounting tabs, then recorded. Boot
   and session hydration are not reliably done by then, so a variable
   amount of unrelated work landed inside the measurement window. Three
   back-to-back runs on identical code spread 2.2x on total_renders and
   3.8x on wasted_renders — wide enough that a single-run before/after
   delta could be mostly noise. Replaced with a quiesce gate that waits
   for commits to hold still before recording, and reports 'quiet:N' or
   'timeout:...' so a contaminated run is visible instead of silent.

2. The counter attributed a context-driven re-render as 'wasted', which
   pointed at memo() as the fix when memo cannot block context at all.
   Adds contextChanged via the fiber's context dependency list, and
   excludes it from wasted.

The gate also turned up a finding worth more than the fix: with five busy
tiles and NO driver running, the renderer still commits ~18x/sec. The
report now names the cascade roots (own state changed, props did not)
rather than leaving them to be guessed at — Streamdown re-renders itself
105 times while idle, which is what drives Block/Ct.
@OutThisLife
OutThisLife enabled auto-merge July 26, 2026 20:57
@OutThisLife
OutThisLife merged commit f695ce3 into main Jul 26, 2026
31 checks passed
@OutThisLife
OutThisLife deleted the bb/desktop-transcript-renders branch July 26, 2026 21:00
@github-actions

github-actions Bot commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

૮ >ﻌ< ა ci review

ran on f7aee9d

all good!

@alt-glitch alt-glitch added type/perf Performance improvement or optimization P3 Low — cosmetic, nice to have comp/desktop Electron desktop app (apps/desktop/*) labels Jul 26, 2026
randlee pushed a commit to randlee/hermes-agent that referenced this pull request Aug 11, 2026
…anscript-renders

fix(desktop): make render-churn measure streaming, not boot churn
prmartinow pushed a commit to prmartinow/hermes-agent that referenced this pull request Aug 26, 2026
…anscript-renders

fix(desktop): make render-churn measure streaming, not boot churn
melon-xf added a commit to melon-xf/hermes-agent that referenced this pull request Sep 3, 2026
…anscript-renders

fix(desktop): make render-churn measure streaming, not boot churn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/desktop Electron desktop app (apps/desktop/*) P3 Low — cosmetic, nice to have type/perf Performance improvement or optimization

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants