perf(home): a streamed talk token wakes no whole-message Home view
Summary
HOT PATH AUDIT area F, row H1 (AUDIT.md). Home shows each Chief reply whole by default, so a streamed talk token changes nothing on screen. Yet each token:
- rebuilt and compared the live run of every conversation (
HomeLiveBook.shown), then assigned the wholelivedictionary; - woke every open Home view's store observation, and each view's inputs (they carried the reply text) differed, so each ran an O(transcript) projection pass on the main thread.
The fix:
publishLiveupdates only the token's conversation (live[c],streams[c], newrunShapes[c]).HomeRunShape: what a whole-message view draws of the running replies (who writes, the activity line, the thought headline), never the text. Whole-message views observe and compare it, so a talk token does not wake them. Typing dots, the activity line and the headline still wake them.- Streaming mode (
HomeReplyDisplay.streaming) reads the text as before.
New perf-hot path id home-stream-token (scripts/cmux-next/perf-hot-benches.json).
Testing
Red test first: HomeWholeMessageTokenCostTests (MessagesLab). It streams 1,500 tokens of the Chief's live run over a 2,000-message history with 1 and 4 views open. It expects 0 store-observation wakes and 0 projection passes, and prints HOMETOKEN lines (ms per token on the main thread).
Observed / Not run
- Observed: compile-check 21869a1f80d8 (red head 7e48dc27c46) and 5d2989681d5e (fix head f3fc5899d39) passed.
- Not run yet: the red step at 572c1cde03f and the green step at f3fc5899d39 (
package-test-lane.sh suite Packages/Shared/CmuxMessagesLab HomeWholeMessageTokenCostTests). The branch waits for a Mac lane line (STATUS 9221). The existing Home streaming suites (HomeStreamingPerfTests, HomeStreamStressTests, HomeMidStreamSendTests, DragWhileStreamingTests) are not run yet either.
Changelog
- Changed: a Chief reply that streams no longer slows typing and scrolling in Home.
No capture: no visible change; only main-thread work per token goes down.
![Autofix with [code]smith](https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-dark-3x.png)
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.
Summary by cubic
Stops a streamed talk token from slowing typing and scrolling in Home. Home shows each Chief reply whole by default, so a token changes nothing on screen — yet before, every token rebuilt and compared the live state of every conversation, woke each open view's store observation, and ran an O(transcript) projection pass on the main thread.
Changes
publishLivenow updates only the token's conversation (live[c],streams[c], newrunShapes[c]).- Adds
HomeRunShape(who writes, the activity line, the thought headline — never the text); whole-message views observe it, so a talk token leaves them asleep while typing dots, the activity line and the headline still wake them. Streaming mode reads the text as before. - Empty shapes are stored as no entry, so thought tokens before a run has any reply text wake no view either.
- Adds perf-hot bench
home-stream-tokenandHomeWholeMessageTokenCostTests(1,500 tokens, 2,000-message history, 1 and 4 views) expecting 0 wakes and 0 projection passes, plus a test for thought-before-reply tokens.