Repository navigation
Read the log once less per admission, and each verb's definition once per fold - #6052
Merged
Merged
Conversation
… per fold Admitting an event read the whole log three times: once in the sender's vocabulary for the contract gates, and once on each side of the append in the active vocabulary to decide whether the event needs the agent's attention. An event made against the newest revision has the same vocabulary for both, so the log before it was read twice. Admission now reuses the first reading there. Each reading's fold (`state_projection`) also rebuilt and deep-copied a widget verb's current state definition for every event, though the definition depends only on the widget and the verb. It is now built once per widget verb per fold. `leaf-dev bench --read server --sizes 128,512,1024 --rounds 3`, base then head, least CPU of 3, ms at 1,024 events: | Page | append | state | | --- | --- | --- | | events | 74.6 → 38.3 | 41.5 → 32.7 | | widgets | 132.7 → 98.3 | 65.5 → 66.3 | | cards | 187.9 → 159.6 | 133.1 → 121.1 | A click's server paths (append, then state) at 512 events: events 58.7 → 33.6, widgets 97.6 → 87.9, cards 129.4 → 110.3. The model tier (`uv run pytest tests/model`, 3,161) passes. > _This was written by Claude Code on behalf of max-sixty_
leaf-agent
approved these changes
Nov 15, 2026
max-sixty
added a commit
that referenced
this pull request
Nov 15, 2026
…per pass for each (#6078) Comments only. After #6052 and #6070, a click on the 1,024-section page `leaf-dev bench` generates shows the server's reading within the 100 ms budget, but sending a comment (159 ms) and resolving a thread (129 ms) still don't. Each remaining whole-page cost now has a note at the code that pays it, saying what it costs there and what change would make it cost what the gesture changed: - `collectEntries` (annotation-inventory.js): rebuilds and re-sorts every group each collection, about 10 ms, twice per send. - `markerName` (margin-projection.js): every marker's name carries its place and distance down, so one new marker renames them all and reads every target's box, about 9 ms per send. Changing it changes what a screen reader hears, so it is the maintainer's call. - `layoutMountedRows` (margin-layout.js): seats every row each pass, kept ones included, about 8 ms a pass. - snapshot.js header: publication knows which members it shared, but readers still diff whole collections. - `admitted_event` (event_contracts.py): `after` and the state read fold the whole log again. - `read_events` (event_log.py): every request parses the whole log, a fifth to a quarter of a request on the cards page at 1,024 events. - event_meaning.py: each move records its container's whole authored order, so the cards log grows with the square of its moves. Asked for by max-sixty. Pre-commit passes on the changed files. > _This was written by Claude Code on behalf of max-sixty_
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.
Admitting an event read the whole log three times: once in the sender's vocabulary for the contract gates, and once on each side of the append in the active vocabulary to decide the event's
attention. For an event made against the newest revision the first two are the same reading, so admission now reuses it. Separately, each fold (state_projection) rebuilt and deep-copied a widget verb's current state definition for every event; it now builds it once per widget verb per fold.Server paths, least CPU of 3, ms at 1,024 events (
leaf-dev bench events widgets cards --read server, base then head):Where to look: the reuse in
admitted_eventholds only when both vocabularies are the same object, whichPageView.registryreturns for one revision; any other case reads the log as before.The model tier (3,161) passes. max-sixty asked for this as part of removing whole-page work from each gesture's path; they haven't read it yet.