Repository navigation
Hold each cost on a large page to the page's size, and measure its growth with leaf-dev scaling - #5252
Merged
Conversation
Reading a page's state and admitting an event cost the square of the page in
four places, each a per-widget question answered by scanning the whole page:
- The obligation inventory scanned every coordinate of the projection for each
obligation (`replayed_attrs`, `obligation_value`, provenance and
registration). `StateProjection` becomes a frozen dataclass whose
`actions_by_owner`, `desired_by_unit` and `classified_by_owner` indexes are
built once per projection; `previously_requested` reads the record's own
classified entries instead of the whole log.
- `markup_value` walked every element of the document for each attribute
record it was asked about. `attribute_marks` reads every attribute record's
marks in one pass (attribute → owner → ids), and `markup_value` takes it in
place of `spk` and the registry. Its holders read it once: the obligation
reducer, construction, stamping's report settlement, `answering_action` and
`page_action_unsettled`. The position readers lose the `spk` they never used.
- `discussed_by` rebuilt its source and frame maps, and scanned every record
for a section's enclosed obligations, for each thread. It now indexes the
records once and returns the reading as a function of the anchor, which
`discussed` and `thread_topics` apply to each thread.
- Revision activation's reanchoring walked every character twice per open
thread (`section_span`). The passage parser records each id's character span
as it writes (`Passages.spans`), which `resolve_quote`, `capture_anchor` and
`_spoken` read.
Every reading is unchanged: `page_state()`, two appends (record and the state
after each), `delivery.batch_data` and a revision activation compare byte for
byte, clock and ids pinned, against the base on 12 synthetic pages up to
W=1600 and T=1600 and 11 real pages, once fields the environment sets are
removed (reading token, producer checkout, activation clock). The runtime
fixtures `tests/served_records.py` prints are identical too.
CPU seconds, base → this change, with the log-log slope over the three largest
sizes:
unanswered asks, empty log (W0) W=3200 read 3.28 → 0.051 (1.93 → 0.94)
append 10.4 → 0.155 (2.12 → 1.10)
widgets each picked once (WC) W=1600 read 0.580 → 0.106 (1.83 → 1.03)
append 1.61 → 0.247 (1.92 → 1.07)
threads at W=400 (TW) T=1600 read 0.487 → 0.117 (1.01 → 0.60)
append 0.861 → 0.135 (0.78 → 0.46)
plain option lists (P) P=800 read 0.555 → 0.079 (1.21 → 0.14)
append 1.26 → 0.186 (1.12 → 0.32)
revision activation, TW pages T=1600 23.2 → 1.06
Typing and clicking on a page with many questions no longer slows with the square of its size. On a page of 128 sections, each an `lf-ask` of four options (7,200 elements), a keystroke took 1,103 ms of main-thread CPU and a click 2,706 ms; they now take 11 ms and 145 ms. Loading it took 3,036 ms and now takes 1,412 ms. The fitted exponents (log cost on log size, 32 to 128 sections) went from 2.07 to 0.41 for a keystroke and from 1.77 to 0.55 for a click (`leaf-dev scaling asks --base`). This is cost 1 of #5194. Causes, each a walk of one page-size collection per member of another: - The to-do stance's `at`, which the keys ask on every scope walk, about seven walks per keystroke, built On me's grouped list to find the to-do the user stands on. Grouping names each item's part of the page with `partOver`, which read every heading's rendered order: items × headings per walk. `doneTodo` now finds the stop among the items in page order, as a walk within a region already does, and asks only where the user stands on a place. - `partOver` itself compared the node with every heading. The outline now keeps each container's headings in order, and `partOver` halves to the last one before the node on each ancestor, so On me's grouping costs items × depth × log headings. - `obligationPlace` scanned the whole inventory for another obligation sharing its context, and its callers place every obligation, so `obligationHolding` and `obligationsIn` cost obligations². The contexts are now counted once per inventory. - `paintKeysWithin` scanned every scoped element for each widget that painted, so a first paint cost widgets². It now records the painted root, and the frame resolves every root with one climb per scoped element. - `holdSelection` read the page selection on every `setChildLists`, and in Chromium a selection read forces style, so each margin cluster's first paint restyled the page. A placement of nodes not yet in the document can't move a selection, so it no longer reads it. - Each margin row's registration read the margin column, whose `getComputedStyle` forced style per row. The layout pass, which reads the column anyway, now observes it. - The thread walk's availability sorted every open thread by rendered order to test whether any was open, on every input. It now asks whether any is. Behavior is unchanged except where two stops stand at one place or nest, such as two to-dos on one element: `doneTodo` now breaks that tie by page order, as `currentLocationStop`'s header says, rather than by On me's order. The two orders differ only under By kind and By <agent>. Remaining, measured and not fixed here: margin pin seating (`coverIn`) reads every sibling of the content for each pin, which is pins × sections per layout pass, and grows past linear from about 256 sections on load, click and wheel.
Root AGENTS.md's Responsiveness section now says how costs may grow with a page: an input's work depends on what it changes and never grows faster than the page; loading and computing or applying a reading grow no faster than n log n. It names the two shapes that break that, a walk of one page-size collection per member of another, and a style or layout pass forced once per element. browser/AGENTS.md adds that `getComputedStyle` forces style, and that in Chromium any read of the selection does too (measured: 200 reads after a write on a 20,000-paragraph page took 2.3 s in Chromium and 0 ms in Firefox). `leaf-dev scaling [AXIS ...] [--sizes] [--base] [--profile]` is the check. It generates pages along an axis (`asks`: sections each holding an `lf-ask`; `prose`: headings and paragraphs; `threads`: comment threads over a fixed page), serves each from the tree, and reads the renderer's main-thread CPU for the load, a click, a keystroke and a wheel step, plus the server's time and bytes for each event a click posts. It fits each cost's exponent over the largest sizes and marks one above 1.3. `--profile` lists the functions whose time grew superlinearly between the smallest and largest page. Three sessions had written this experiment as a throwaway script (#5063, #5061, #5194).
…kup once Fixes from review of the two earlier commits: - `doneTodo` again reads the walk's stops in On me's order, so where two to-dos stand on one element under By <agent>, `x` ends the one On me and `m` select. It reads them only where some item on the user offers Done and the user stands on a place; every other keystroke returns at once. With the outline index, building the stops costs items × depth × log headings rather than items × headings. - A root `paintKeysWithin` recorded is resolved before Leaf's mover moves a placed node (`installMoveKeys`, dom-move.js), so a control that leaves a painted root before the frame keeps its mark. Placing nodes not yet in the document resolves nothing, so a first paint still batches. - `obligationPlace` asks the shared-context set's size and membership rather than copying it. - `handed_over` reads the page's `(by_id, attribute_marks)` once for every page action it settles; `page_action_unsettled` had built both per action. - `leaf-dev scaling` waits for each click's event answer, and reads CPU profiles through `profile.py`'s reader. - browser/AGENTS.md: a Chromium selection read can force style, not always does.
… painted root Review of the previous commit found that resolving every pending painted root before any placed node moved brought back a scan of every scoped element per widget wherever renders reorder retained children between paints: 16,256 scope visits for 128 roots each reversing two children. Now a node about to move out of a painted root marks the scoped elements it holds, a walk of the moving subtree only, and the frame resolves the rest of the roots once as before.
# Conflicts: # browser/runtime/queue-walk.js # dist/kernel/kernel.json # dist/kernel/leaf.js # dist/kernel/runtime/bundle-data.js # dist/kernel/runtime/bundle-portable.js
leaf-agent
previously approved these changes
Nov 3, 2026
# Conflicts: # dist/kernel/kernel.json # dist/kernel/runtime/bundle-portable.js
leaf-agent
approved these changes
Nov 3, 2026
max-sixty
added a commit
that referenced
this pull request
Nov 4, 2026
… the history it lacks, and fail superlinear growth daily (#5271) #5252 wrote the rule into root `AGENTS.md`, "Responsiveness": no cost of a large page grows faster than the page. It also fixed the paths that broke the rule worst. This PR fixes the rest of what measurement and review found, in the browser and on the server. It also sends each tab only the history it lacks, and adds a daily test that fails any cost whose growth passes n^1.5. Part of #5194. ## Browser Five steps walked one page-size collection for each member of another: - `coverIn` read every sibling's box for each margin pin. `pinSeating` now reads each parent's children once per pass, sorted by top, with a tree of the lowest bottom over each run. Each pin visits only the children that reach into its band. - The margin layout's last loop read positions after writing each row, which forced a layout per row. It now reads every row first, then writes. The merge with #5225 needed the same fix for its new `subject` field. - `hearTargetChanges` tested every row against every moved node. It now collects the moved nodes once and climbs from each row's target. - `obligationHolding` placed every obligation to find a node's. It now climbs the node's ancestors through an index of where obligations sit (`namedPlaces`). - `claimPaintedRoots` climbed from every scoped element. It now walks only the outermost painted roots. On 512 questions (`leaf-dev scaling asks`, main and branch in one run), main-thread CPU went: | | main | this PR | |---|---|---| | click | 680 ms | 374 ms | | keystroke | 16 ms | 8.5 ms | | wheel step | 45 ms | 28 ms | The keystroke's growth exponent went from 1.96 to flat. On this loaded host one run can differ from the next by 2×. An earlier run measured clicks at 1.6 s on main and 0.6 s here. ## Server Each of these walked a collection once per member of another; each now reads it once per reading. The table gives CPU seconds before → after on generated pages: | Path | Before → after | |---|---| | delivery batch: thread anchors, unsent work, `batch_threads` | 9.83 → 0.29 at 6,400 threads | | `page_action_unsettled` (`PageSettlement`) | 3.94 → 0.24 at 3,200 asks; 25.2 → 0.08 for a board of 1,600 moved cards | | `previously_requested` and conditional writes | 11.7 → 0.05 at 800 conditionals | | board columns (`AuthoredOrders`, replacing `authored_positions`) | 3.43 → 0.04 at 800 boards | | `record_members` | 1.12 → 0.15 for 800 picked groups | | thread questions (`ThreadAnswers`) | 0.58 → 0.22 for 1,600 questions | | `leaf page state PAGE THREAD` | 1.79 → 0.49 for 1,600 messages | Every reading is byte-identical to the base on 28 pages, 13 of them copies of real pages: `page_state()`, `delivery.batch_data`, `leaf page state` at several limits, and two appends. ## History tail A click's answer used to carry the whole history, so a session's traffic grew with the square of its log. Now each answer carries `browser.basis.key`, and the tab sends the key of the reading it holds back as `Leaf-Held-Basis`. The server re-reads the history lists at that sequence within the same page transaction. It sends what is new or changed, plus `since.dropped`, and the browser completes the tail into a whole reading before anything adopts it (`completeState`). The server keeps no record of what each tab holds. A key it can't extend gets the whole answer. `state.schema.json` drops `receipts` and `coverage`, which the browser now derives, and adds `browser.basis.key` and `since`. On 64 asks with 200 events, a click's answer goes from 664 KB to 30 KB. When the log has moved, the server spends 4.5–8 ms more per answer. No protocol bump: this changes the served state, not the log. ## Daily test `tests/journeys/test_scaling.py` measures each `leaf-dev scaling` axis at 8, 64, 128 and 256. It measures each size twice, interleaved, and keeps the lower reading. It fails a cost whose growth above the 8-section page fits an exponent past 1.5. Fitting the cost itself, as `leaf-dev scaling` first did, let fixed work hide growth: a click's 30 ms of fixed work plus 20/80/320 ms of quadratic work fitted 1.4. Fitting its growth gives 2.0. The test scored 0/45 false alarms on real readings taken at load 50. It missed 14 of 36 injected 100 ms quadratics, where fitting the cost missed 24. `leaf-dev scaling` uses the same `exponent` and the same threshold. It measures the 8-section page every run, and its `!` marker moves from 1.3 to 1.5. ## Review and tests Four Codex reviews re-ran their own cases against each commit's parent and found no behavioral difference. For the history tail, they covered undo, pickup, revision changes, two tabs, refusals, a restart and crossed answers. All of these pass: - model tests (1,886); - `pnpm run check`, including the runtime tests; - the margin, On me and key-scope browser tests; - the interact-server process tests; - the daily test, on all three axes. ## Left out - Four scans that walk one widget's members or one thread's history per member, rather than the page. A move compares its column's order, a selection searches its picked values, a batch checks each summary against earlier ones, and a conditional's history scans state events per revision. - Button reflection, which rereads every declaration each frame. That costs 9.5 ms per keystroke at 512 sections and grows linearly. - A click on 512 threads still answers with about 1 MB, mostly threads, workflows and obligations sent whole. That grows linearly with the page. > _This was written by Claude Code on behalf of max-sixty_
This was referenced Nov 4, 2026
leaf-agent
added a commit
that referenced
this pull request
Nov 5, 2026
#5500) #5252 moved the margin layout's size watch on the body and the column out of `registerMarginRow` and into the layout pass, so that a first paint wouldn't read the column once per row. That also delayed the watch's first deliveries to a later pass, while the page was still settling. On `pr-walkthrough`, `notification-playground` and `thread-panel-gallery`, the layout pass those deliveries trigger then resizes boxes the observer loop has already delivered, and Chromium raises `ResizeObserver loop completed with undelivered notifications`, which fails `test_page_fixture_renders` at teardown. The first registered row now starts the watch with one column read, as it did before #5252. The layout pass still keeps the observed column current, so the rows after it read nothing, which keeps #5252's saving. Nothing changes on screen. **Verification.** `uv run pytest --run-nightly "tests/journeys/test_render_gate.py::test_page_fixture_renders[<page>]"` fails on main (`f8808301f`) for all three pages and passes with this change. `pnpm run test:runtime` passes, as do `check:browser` and the margin browser tests `test_rail.py` and `test_pins.py`. `test_entries.py::test_an_inline_contribution_name_needs_no_physical_margin` fails both with and without the change; #5473 tracks it. <details><summary>How the cause was found</summary> - `git bisect` over `19757c94c..8b759a5`, running the `notification-playground` case and marking only the ResizeObserver error as bad, lands on `7f857fd0f` (#5252). Its parent `aef8926c5` passes. - I logged each `sizeObserver` delivery up to the error. On `pr-walkthrough`, the last delivery before the error is the margin watch's first notification for the column (`MAIN.layout-sidebar`), which arrives after the page's other observers have already delivered several rounds. On `notification-playground` the watch hadn't delivered at all before the error. There the final write is the playground's `--playground-controls-height` in its own observer, and removing that write also clears the error. So the playground's write is one way a late-settling page trips the loop, not a separate cause. - Putting the watch's start back at registration clears the error on all three pages. `tests/browser/test_render_controls.py::test_sample_host_view_changes_leave_its_scroll_and_keyboard_position`, which the issue also names, has a different cause. It passes at `7f857fd0f`, bisects to `61afa3016` (#5361), and still fails with this change. #5486 tracks it. </details> Closes #5464 — automated triage Co-authored-by: leaf-agent <[email protected]>
max-sixty
added a commit
that referenced
this pull request
Nov 10, 2026
Tend's PR review now checks each change against the open backlog and gets the description to close what the change settles. Where the change leaves nothing of a `backlog` issue to do, by finishing what remains, removing its premise or recording a decision against what it asks, the description says `Closes #N`. Where it does part, the description says `Part of #N` and what is left, so the review of the last part can tell that part finishes the issue. On Tend's own pull request the review edits the description. On someone else's it asks in the review, and the ask goes in an approval rather than holding one back. The rule is a new section of `running-tend`, **Issues a change finishes**, after **Review threshold**. ## Why Leaf's backlog triage of 2026-11-04 found seven merged pull requests that did an open backlog issue's work without closing it. Four said `Part of #N`: #3879, #3902, #3856 and #3868. Three named no issue: #4487, #4124 and #5039. Nothing asked those three to look, since `/developing-leaf` asks for `Closes #N` only of a session that starts from a backlog item. Tend's nightly sweep reads a seventh of the open issues each night, long after the diff has left the reader's context, and, by the triage's count, it commented on none of them in ten nights. The review is the step every change passes with its diff in hand. The replay below sorts the seven more finely than the triage did. #4011, #4036 and #4013 were settled by #3879, #4124 and #5039. #3902 did half of #4023, whose five composition defects stayed open. #3856, #3868 and #4487 each did one item of #4027, which is still open. For those four the right description is `Part of #N` with what is left. A `Closes #N` would have been wrong. ## Replay Each case gets the rule as this branch ships it, together with `running-tend`'s **Review threshold** section, which it competes with. It also gets the PR's title, author, description and diff, capped at 80k characters with vendored files left out, and every `backlog` issue open when the PR merged, as it read then. That list is rebuilt from the issues' creation and close times, label events and body edit history, plus their comments up to the merge. Each case runs once through a headless `claude -p` on `claude-opus-5-5` (the review's model), with no tools, in a scratch home. The JSON verdict is graded against an expected answer fixed before the run. | PR | What it did | Expected | Result | | --- | --- | --- | --- | | #3879 | the play-through #4011 asked for | close #4011, or part with its open decision left | pass: part, the decision and the home-page test left | | #3902 | #4023's touch-target half | part of #4023 | pass (also part of #4027) | | #3856 | #4027's Android back item | part of #4027 | pass | | #3868 | #4027's Draw mode item | part of #4027 | pass | | #4487 | #4027's lf-draft back item | part of #4027 | pass | | #4124 | recorded the call that settled #4036 | close #4036 | **miss**: read #4036 and judged the call unrelated | | #5039 | one held-news count, #4013 | close #4013 | pass (also part of #4012) | | #5331 | removed #4060's premise | close #4060 | pass | | #4643, #4718, #4847, #5020, #5252 | nothing in the backlog | nothing | 5 pass | | #5441, #5446, #5454 | rightly a part of an open issue | that part | 3 pass | | #4212 | rightly said `Closes #4037` | close #4037 | pass | That is 6 of the 7 triage cases, the premise case, and 9 of 9 controls. No run closed or named an issue it shouldn't have. #5020 is a hard negative: it changes held-news notices, which #4013 is about, and the run left #4013 alone. #4124's miss held in all three wordings tried. The triage itself only inferred that the 2026-10-25 call in `reading-place.js` covers #4036's case. The clause for a removed premise or a recorded decision goes beyond the two cases Max named. It is there because the triage closed several issues as obsolete after a landed change removed their premise. Without the clause, the #5331 run read #4060 and declined: "It only makes one sentence of the issue's background out of date". With it, the run closed #4060. Two grades were corrected after the first run, each on evidence from the record. #5252 says `Part of #5194`, but #5194 was labelled `backlog` only on 2026-11-05, after #5252 merged. #5039 left a count that gains a digit outgrowing its room, as its own `thread-card.js` comment says, and #5288 fixed that on 2026-11-04, so `Part of #4013` naming that is also right at merge time. The final wording closed #4013 anyway. ```sh uv run python .tmp/replay/replay.py --jobs 4 uv run python .tmp/replay/replay.py --only 5331,4124 --rule-file .tmp/replay/arm-finishes-only.md --runs runs-finishes-only --results results-finishes-only.json ``` The final wording's 17 runs cost $6.75. All runs together cost $19.64, across three wordings and the two-run ablation. The script, cases, prompts, answers and results are in `.tmp/replay/` of the worktree that wrote this PR, not committed. The last run used this text before one sentence was split in two. ## Decisions Max may reverse - **Where the rule lives.** It lives in `running-tend`, which only Tend loads. `/developing-leaf`'s `Closes #N` under **Take a backlog item** stays as it is. That rule claims an item early: the closing keyword is what makes `TODO.md`'s `-linked:pr` query skip it. The review then corrects a claim the change only partly fulfils to `Part of #N`. Repeating the search in the author's skill would make every Leaf session pay for a check the review already makes on every PR. - **How it acts on others' pull requests.** The review asks and doesn't edit, since the author owns the description and Leaf sessions rewrite it whole from a file. The ask doesn't withhold approval. `tend-review` runs on `opened`, `synchronize`, `ready_for_review` and `reopened`, not on `edited`, so a held approval would wait for the next push. The review approves with the ask as its body. - **Scope.** Only issues labelled `backlog`. CI failure reports and cause issues close by their own routes. ## Not verified - **Use inside a full review.** The replay gives the section on its own, with the backlog inline. It shows that the rule, once applied, picks the right issue. It doesn't show whether a whole Tend review, with the bundled review skill in context, remembers to apply it. Tend's next reviews will show that. - **What-is-left lists.** The replay leaves out the earlier PRs that name each issue, which the rule tells the review to read. So its lists repeat items that earlier parts had done. #5454's ask lists #4027 items that #3856 and #3868 had finished. - **Repeat runs.** Each case ran once. > _This was written by Claude Code on behalf of max-sixty_ Co-authored-by: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Typing and clicking on a large page no longer slow with the square of its size, and reading its state no longer does either. On a page of 128 sections, each an
lf-askof four options (7,229 elements), a keystroke took 1,311 ms of main-thread CPU and now takes 12 ms; a click took 2,623 ms and now takes 171 ms; loading took 3,935 ms and now takes 1,158 ms. Reading the state of a page with 3,200 unanswered questions took 3.28 s of server CPU and now takes 0.051 s. RootAGENTS.mdnow states how each cost may grow with the page, andleaf-dev scalingmeasures it. Part of #5194, its cost 1.The rule
Root
AGENTS.md, "Responsiveness", gains a paragraph. A page's size is how much it holds: elements, widgets, headings, obligations, threads, events and revisions. The work an input does depends on what the input changes and never grows faster than the page; loading a page, and computing or applying a reading of it, grow no faster than n log n. It names the two shapes that break this: a step that walks one page-size collection for each member of another, and a style or layout pass forced once per element.browser/AGENTS.mdadds thatgetComputedStyleforces style, and that in Chromium a read of the selection, such asrangeCount, can too (200 reads after a write on a 20,000-paragraph page took 2.3 s in Chromium and 0 ms in Firefox).A literal "nothing O(n²)" would be both too strict and too weak. Quadratic work over a set that doesn't grow with the page, such as the keyboard scopes, costs nothing, and a style pass forced inside a loop is quadratic in code that reads as linear. So the rule says what n is, budgets each path, and is checked by measurement.
Browser
Each cause was a walk of one page-size collection per member of another, or a forced style pass per element:
doneTodo, queue-walk.js), which the keys ask on every scope walk, about seven per keystroke, built On me's grouped list each time. It now returns at once unless an item on the user offers Done and the user stands on a place. Past that, the On me card the user is on decides, and otherwise it builds the walk's stops in On me's order as before.partOver(thread/placement.js), the heading an item stands under, compared the node with every heading. The outline now keeps each container's headings in rendered order, keyed on the reading and document versions, andpartOverhalves to the last one before the node on each ancestor: depth × log headings.obligationPlace(obligations/place.js) scanned the whole inventory for another obligation sharing its context, and its callers place every obligation, soobligationHoldingandobligationsIncost obligations². Contexts are now counted once per inventory.paintKeysWithin(keyboard/scopes.js) scanned every scoped element for each widget that painted, so a first paint cost widgets². It records the painted root, and the frame resolves every root with one climb per scoped element. A connected node that Leaf's mover is about to move out of a painted root marks the scoped elements in its own subtree first (installMoveKeys, dom-move.js), so a control that leaves before the frame keeps its key mark.holdSelection(native-selection.js) read the page selection on everysetChildLists, which in Chromium forced style once per margin cluster. Placing nodes not yet in the document can't move the selection, so it no longer reads it.Behavior is unchanged; the kernel in
dist/kernel/is rebuilt from these modules.Server
Reading a page's state and admitting an event cost the square of the page in four places, each a per-widget question answered by scanning the page:
StateProjectionbecomes a frozen dataclass whoseactions_by_owner,desired_by_unitandclassified_by_ownerindexes are built once per projection.markup_valuewalked the document for each attribute record.attribute_marksreads every record's marks in one pass, and its holders read it once: the obligation reducer, construction, stamping,answering_action, andhanded_overfor every page action it settles.discussed_byrebuilt its record maps for each thread. It indexes the records once and returns a function of the anchor.Passages.spans).Every reading is unchanged:
page_state(), appends,delivery.batch_dataand a revision activation compare byte for byte against the base on 12 synthetic and 11 real pages, with the clock and ids pinned.leaf-dev scalinguv run leaf-dev scaling [AXIS ...] [--sizes] [--base] [--profile]generates pages along an axis (asks: sections each holding anlf-ask;prose: headings and paragraphs;threads: comment threads over a fixed page), serves each from the tree, and reads the renderer's main-thread CPU for the load, a click, a keystroke and a wheel step, with the server's time and bytes for each event a click posts. It fits each cost's exponent (the slope of log cost on log size) over the largest sizes and marks one above 1.3.--basemeasures the merge base beside the tree, and--profilelists the functions whose time grew faster than the page.Main-thread CPU in ms,
leaf-dev scaling asks --sizes 32,64,128 --base:Server CPU in seconds, base → branch: 3,200 unanswered asks with an empty log, read 3.28 → 0.051 and append 10.4 → 0.155; 1,600 widgets each picked once, read 0.58 → 0.11; revision activation with 1,600 threads, 23.2 → 1.06.
Still failing the rule
coverInreads every sibling of the content for each pin, so a layout pass costs pins × sections. Past about 256 sections the click and wheel exponents rise to 1.37 and 1.33.page_action_unsettledscans the log per action in force, andpreviously_requestedfolds a log prefix per qualifying action.Checks
pnpm run check; browser tests for the to-do stance, On me grouping, shortcut reflection, the selection hold, margin pins and the thread walk; the model tests for workflows, obligations and delivery;leaf-dev scalingon all three axes with--base.