Skip to content

Bench opening a diff line's comment box on a page of n asks - #5864

Merged
max-sixty merged 1 commit into
mainfrom
bench-diff-comment-box
Nov 12, 2026
Merged

max-sixty merged 1 commit into
mainfrom
bench-diff-comment-box

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

No benchmark input measured opening a comment box: comment opens its box while getting ready and times only the send. This adds open, which clicks the comment control on a line of a one-file lf-diff and times the click to the first frame that shows the box with the caret in it. The patch stands above ask_sections' sections, whose margin pins grow with n, so the reading grows when the margin places every row again after the box grows the diff in the page's flow (#5752).

Where to look: the patch goes on every page built on ask_sections (asks, asks-marked, widgets, events, revisions), so their readings rise by its fixed cost from the first daily run after this lands. The threads page was the obvious home, but it puts its threads on 64 sections, so it never has more than 64 margin rows and the cost hardly grew there (49 to 55 ms of CPU from 64 to 256 threads).

Result on asks in Chromium, on this Mac under load: open takes 36 / 73 / 102 / 175 ms of CPU at 8 / 64 / 128 / 256 asks (exponent 0.96), and 24 to 140 ms from the click to the paint. In Firefox it takes 73 to 221 ms of CPU.

Max asked for a bench input that would have caught the slow comment box on a busy page; he hasn't read this yet. Checked: leaf-dev bench asks with every input, --input open at 64 / 128 / 256 in Chromium and Firefox, and pre-commit.

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

No benchmark input measured opening a comment box. `comment` opens its
box while getting ready and times only the send. On a busy page,
opening the box from a diff line's `+` took 100-250 ms
(`pr-walkthrough`, 60-150 threads). Most of that is the margin placing
every row again once the box grows the diff in the page's flow (#5752).

The `open` input clicks the comment control on a line of a one-file
patch. It times the click to the first frame that shows the box with
the caret in it (`composer` in painted.js). The patch now stands above
the sections `ask_sections` writes, whose margin pins grow with n, so
opening the box moves every section and pin. On the `threads` page the
cost hardly grew (49 to 55 ms of CPU from 64 to 256 threads), because
that page puts its threads on 64 sections and so never has more than
64 margin rows.

Measured on this Mac under load (load average 10-18), one round:

| asks page                 |  8 | 64 | 128 | 256 | exponent |
|---------------------------|----|----|-----|-----|----------|
| open cpu ms, Chromium     | 36 | 73 | 102 | 175 | 0.96     |
| open painted ms, Chromium | 24 | 51 |  80 | 140 |          |
| open cpu ms, Firefox      | 73 | 90 | 176 | 221 | 0.52     |

At 256 asks in Chromium, the long frames name the margin's
ResizeObserver callback (67 ms), the presentation pass (41 ms) and the
diff's click handler (36 ms). The daily run will now read this growth.

Every page built on `ask_sections` now holds the patch: `asks`,
`asks-marked`, `widgets`, `events` and `revisions`. Their load and input
readings rise by the patch's fixed cost from the first run after this
lands. A full pass of every input on `asks` still runs, `comment` and
`resolve` after `open` included.
@max-sixty
max-sixty merged commit df1a0dd into main Nov 12, 2026
7 of 8 checks passed
@max-sixty
max-sixty deleted the bench-diff-comment-box branch November 12, 2026 09:27
leaf-agent added a commit that referenced this pull request Nov 13, 2026
…ch uses (#5918)

The scheduled `bench` job has failed since #5864 ([run
43204020539](https://github.com/max-sixty/leaf/actions/runs/43204020539)):
`leaf-dev bench`'s server read stopped at `server_paths.build` with
`AssertionError: <lf-diff> (line 1): unknown widget — not in the page's
registry`, after the browser tables but before any server table. #5864
put an `lf-diff` patch above every page built on `ask_sections` (`asks`,
`asks-marked`, `widgets`, `events`, `revisions`). The browser bench
builds those pages with the example catalog's layer
(`page_fixtures.source_packages` falls back to `examples/layer.json`,
which selects `diff`), but `server_paths.build` called `cmd_init` with
no packages. It now selects that same layer, so both reads measure the
same page.

Verified on current main: building `asks` at size 8 raises the same
assertion before the change. After it, `asks`, `revisions` and `threads`
build, and `uv run leaf-dev bench asks widgets --read server --sizes
16,32 --rounds 1` completes with every server path read. Server readings
for every collection now include activating and checking against the
full example layer, so the first daily run after this may shift their
fixed cost.

Refs #4225 — automated triage

Co-authored-by: leaf-agent <[email protected]>
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