Skip to content

Patch inside a tab set's members instead of rebuilding the page, and stop an idle corpus repainting - #1279

Merged
max-sixty merged 4 commits into
mainfrom
corpus-in-tab-latency
Sep 27, 2026
Merged

max-sixty merged 4 commits into
mainfrom
corpus-in-tab-latency

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

The corpus page missed the in-tab responsiveness objectives in notes/user-feedback-responsiveness.md: a new revision took ~2.8 s to swap in (1 s objective), and a comment ~220 ms and a board move 111–155 ms to paint (100 ms). Profiling each transition found three causes, none specific to the corpus.

A revision rebuilt the whole page. The in-place patch treats every upgraded widget as atomic, and the corpus (like any page written as tabs) sits inside one lf-tabs. So a one-sentence edit evicted the tab set and re-inserted the page: one 2.1 s insertBefore that reconnected every widget, rebuilt five lf-specimen iframes, and re-collected the margin once per reconnecting widget. It also fetched the revision document a second time after the install. A new registry key, x-patch: members, which lf-tabs declares, says the module builds its controls beside its members and reads only their attributes. The patch now reaches inside such a widget while the revision keeps its shell: its own attributes and each member's tag and attributes, in order. A shell change (a tab added or relabeled) still rebuilds it.

An idle corpus repainted the thread layer about 6 times a second. The example lf-sort-film auto-played inside a tab hidden with until-found, which still has client rects. Each step announced a layout change, and that re-ran the whole thread presentation and re-read the page. This was the input delay behind the comment and move timings. The film now plays only when checkVisibility() says it is shown.

Each thread pass re-read margin targets' words. addressableSays walked every margin target's text on every pass, about 200 ms of a corpus comment. elementReading in passages.js now keeps that answer exactly as long as the page reading, under the same mutation watcher. The watcher also counted the thread panel rewriting name on its <details> rows as a change to the page's words. name matters only on a <slot>, so it counts only there. A corpus comment now re-reads the page 3 times instead of 6.

Measured with the #14 benchmark's transitions on one corpus page:

corpus transition before after
revision: requests / bytes 33 / 2.18 MB 10 / 686 KB
revision: presented 3.0 s 1.3 s
comment: thread-pass CPU (profile) ~400 ms ~250 ms

The machine's load average was 30–70 throughout, so read the times as direction, not values. The requests and bytes are exact.

Left alone: triage-board's revision is served at 163 KB against 3.8 KB stored. 142 KB of that is the runtime stylesheets every delivered document inlines (delivery_sheets), sent uncompressed by the local server. Production compresses it to about 11 KB.

This was written by Claude Code on behalf of max-sixty

🤖 Generated with Claude Code

max-sixty and others added 4 commits September 26, 2026 21:55
An in-place revision treats every upgraded widget as atomic: its module owns
everything under it, so any change to its markup evicts it and re-inserts
the new one. The corpus, and any page written as tabs, sits inside one
lf-tabs, so a one-sentence edit rebuilt the whole page. On the corpus that
was a 2.1 s insertBefore that reconnected every widget, rebuilt five
lf-specimen iframes, re-collected the margin once per reconnecting widget,
and fetched the revision document a second time after the install.

A new registry key, `x-patch: members`, says a widget's module builds its
controls beside its members, leaves them where the author wrote them, and
reads only their attributes. lf-tabs declares it. The patch then reaches
inside such a widget while the two revisions agree on its shell: its own
attributes and each member's tag and attributes, in order. A change to the
shell (a tab added, a label renamed) still rebuilds it. The schema allows
the key only on an upgraded members container, and `$keys`, docs/registry.html
and the packages.md table describe it.

Measured with bench_page_latency's corpus revision transition: requests
33 -> 10 and bytes 2.18 MB -> 686 KB, and presented in 1.3 s against 3.0 s
in the same probe (timings on a loaded machine).

New test: a sentence edited in one tab keeps the tab set, the open tab and
the question in the other tab; a revision adding a tab rebuilds the strip.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
lf-sort-film started playing when it had client rects, which it still has
inside a tab hidden with `until-found`. On the corpus it played behind the
Triage tab at frame rate, and each step's `parts.update()` announced a
layout change that made anchor-controls repaint the whole thread
presentation and re-read the page: about 6 full passes a second on an idle
tab, which is the input delay the corpus comment and move timings carried.
`checkVisibility()` answers false under a content-visibility: hidden
ancestor, so the film now waits for a tab the user opens.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…ails name

Each thread presentation pass asked addressableSays for every margin
target's words, and each call walked the target's text asking every text
node where it stands; on the corpus that was about 200 ms of a comment's
pass. `elementReading` keeps that answer for a page element exactly as
long as the page reading, since the one watcher already says when either
moved; chrome and detached nodes are read afresh.

The watcher also counted the thread panel rewriting `name` on its
<details> rows as a change to the page's words. `name` is watched for slot
assignment, which only a <slot> does, so it now counts only there. A
corpus comment re-read the page 3 times instead of 6.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@max-sixty
max-sixty merged commit e3e7637 into main Sep 27, 2026
5 checks passed
@max-sixty
max-sixty deleted the corpus-in-tab-latency branch September 27, 2026 05:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants