Skip to content

Read the log once less per admission, and each verb's definition once per fold - #6052

Merged
max-sixty merged 1 commit into
mainfrom
fix-mac-only-tests
Nov 15, 2026
Merged

max-sixty merged 1 commit into
mainfrom
fix-mac-only-tests

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

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):

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

Where to look: the reuse in admitted_event holds only when both vocabularies are the same object, which PageView.registry returns 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.

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

… 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_
@max-sixty
max-sixty merged commit f62a024 into main Nov 15, 2026
5 checks passed
@max-sixty
max-sixty deleted the fix-mac-only-tests branch November 15, 2026 18:55
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_
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