Repository navigation
Bench #4781's tabs of large documents, with the inputs that found its costs - #6033
Merged
Merged
Conversation
… costs `leaf-dev bench documents` generates a side list of tabs, each holding a text document bound to its own source: the shown document and one more in a closed tab for each eight of `n` (33 at 256, about #4781's 30), each 2,048 lines of Python. The documents grow in number and each stays as long, so a cost that grows with the documents a page holds shows in the exponent. The sources go through the fixture's data companion, so each arm builds the page with its own Leaf; `Collection` gains `data` for it. Five inputs read the costs agents found on #4781's page by hand this week: `data` (an agent's `leaf data set` changing one line of the shown source, #5992), `reveal` (opening a closed tab, #5996), `browse` (a run's height of wheel after opening every tab, for the colour ranges closed tabs keep), `search` (the first open of page search, #5999) and `matches` (a search for a word on every line, to its final count). Each finds what it acts on through `page.evaluate`, as `holds` now does, since a Playwright locator walks every element of a large page for each query. `held` now covers the requests and bytes an input causes, so a write to one source that sends every source is marked; `Input.whole` exempts a revision, which carries the new document, and a search's count. On the daily report of 2026-11-14 only `revision KB` and `stamp KB` grow, so the existing pages gain no mark. Each fix reverted shows its cost again, against main beside it: #5992's `data KB` fits 1.08 `!` (164 to 2,722 KB; main 82.6 at every size), #5996's `reveal cpu` 1.77 `!` in Chromium (43 to 118 ms; main 41 to 53), #5999's `search cpu` 0.82 `!` in Firefox (45 to 165 ms; main 24 to 30). Main itself marks `browse` (1.21, `unpaint` growing), `search` in Chromium (0.79) and `load cpu` (1.53, `headingsIn` growing). The daily job runs the page with these five inputs: 284 s on this Mac.
…answer Review of the documents page found that `search`'s Chromium mark was `browse`'s cost seen again: run alone, the first open of page search reads level, and after `browse` has opened every tab, each keeping its colour ranges, it grew 21 to 44-47 ms. `search` and `matches` now come before `browse`, which puts away page search before it opens the tabs. `browse` takes 16 steps rather than 8: on the page with one more document, three runs of eight read its exponent at 0.49 to 0.75, and two of sixteen at 1.04 and 0.96. `held` read the input of `comment event KB` as `comment event`, which no input is, so the size of each POST's answer was judged at the loose limit, and the fixed 10 KB floor hid a small answer's growth. A reading now names its input by its first word, and a held count's floor is a share of its own BASE reading, at least one. Re-judged, the nine daily reports of 11-06 to 11-14 gain one mark: `asks` `comment event KB`, 4.9 to 19.6 KB in the reports of 11-06 to 11-11, exponent 1.08. `reveal` opened the second tab and then the first, which the page drew at load, so its mean halved a first open's cost. The page now holds one more document, and `reveal` opens the second tab and then the third. The inputs need the page's own ids (`#docs #d0[source]`) and count its tabs by them. The daily job measures `documents` in a step of its own, which runs after a failed one, and collects every page's readings to chart once both have run.
…ents table `held` unpacked a reading into its first and last words, which a one-word reading such as `elements` can't fill, so a caller passing one raised `ValueError` where it used to get False. It now takes the first and last word of any reading, so `elements` names no input and is not held. The daily job writes the `documents` table to its own `documents.txt` in the `bench-report` artifact, so Tend's benchmark review in `running-tend/SKILL.md` now names it beside the browser and server tables.
max-sixty
marked this pull request as ready for review
November 15, 2026 10:23
leaf-agent
approved these changes
Nov 15, 2026
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.
leaf-dev benchnow generates #4781's page, a side list of tabs each holding a large text document bound to its own source, and measures the inputs that found this week's costs on it by hand. The dailybenchjob runs it, so Tend's review sees these costs grow with the page.The page
documentsholds the shown document, one more in a closed tab for each eight ofn, and one more again: 3 documents on the BASE page, sorevealhas two closed tabs to open there, then 10, 18 and 34 at the daily sizes 64, 128 and 256, about #4781's 30 tabs at the largest. Each source is 2,048 lines of Python (16 of a listing's 128-row runs), the same at every size. So a cost that grows with the documents a page holds grows withnand shows in the exponent. A cost that grows with the length of the one document opened stays level and shows only beside another arm (--base).The largest page holds 69,000 rows where #4781's held 2.9 million. That is enough for a walk of every panel on each tab switch (#5996) to fit an exponent in Chromium, and it keeps the daily run short (below). The text is Python rather than #4781's Markdown, because Python's syntax colour paints most words, and the colour a closed tab keeps is what
browsereads.The sources are set through the fixture's data companion (
page.data.json, whichprepare_pagesets withleaf data set), so each arm builds the page with its own Leaf.Collectiongainsdatafor it, whichserver_paths.buildalso sets in process.The inputs
dataleaf data setchanges the first line of the shown document's source;paintedis the frame that draws the new linerevealsearch/, which opens page searchmatchesvalue, which every line holds, into page search, until the count is finalbrowseThey run in that order, so
searchandmatchesread the page beforebrowsehas opened every tab, whose kept colour every later input would meet. They need the page's own ids (#docs #d0[source]) and find the other tabs and documents by them. Each finds what it acts on throughpage.evaluate, never a locator, since a Playwright locator walks every element of the page for each query.holds, which decides whether a page has what an input needs, now asks the document withquerySelectorfor the same reason.painted.jsgains three facts:shows(an element is drawn and holds some words),searching(page search's field holds the caret) andsearched(its count is final).BenchPage.writtentakes the file a command writes, here the source's file rather than the log.What the marks hold
heldnow covers the requests and bytes any input causes, the size of the answer to each of its POSTs (<input> event KB) included, besides the CPU of an input the browser answers alone: rootAGENTS.md, "Responsiveness", holds an input's work to what it changes. Without it, #5992's cost, every source sent to the tab after a write to one, fits exponent 1.08 with no mark, since an agent's write may grow with the page. An input whose result is the whole page is exempt, through a newInput.whole:revisionandstamp, which carry the new document, andmatches. A held count's noise floor is a quarter of its own reading on the BASE page and at least one, where every count's was a fixed 10 KB or one request.Re-judged under main's rules and this branch's, the nine daily reports of 11-06 to 11-14 differ in one reading:
askscomment event KB, 4.9, 8.1, 11.9 and 19.6 KB across the sizes in the six reports of 11-06 to 11-11, now marked at 1.08. Those reports showed it with no mark; it reads level from 11-12 on. On this page's runs the only differences arematches, whichwholelets grow, anddata KBwith #5992 reverted.Evidence
All on this Mac (M5 Max, 18 cores, load average 3–21 from other sessions),
uv run leaf-dev bench documents --sizes 64,128,256 ….Current main, Chromium, the daily job's command (
--rounds 2 --input data --input reveal --input search --input matches --input browse), 266 s:Current main, Firefox, the first commit's page and input order with
--browser firefox:What main shows, with a V8 profile of each growing input from
--profile, which lists the functions whose time grew past the input's limit from the smallest page to the largest:browse, 0.81!in Chromium, and 0.96 and 1.04 in two runs ofbrowsealone. A closed tab keeps the colour ranges of the runs it last showed (896 a tab here), and each run a step colours rebuilds highlights holding every opened tab's ranges. The profile namesunpaintandfollow(lf-text-document.js), 3 to 40–45 ms. This is the cost Open a closed tab without walking every panel's document #5996's body left unmeasured, which Colour only the documents on screen, and rewrite only the rows a new text changes #6035 removes: with its change, review readbrowselevel. Firefox grows too (44 to 68 ms), but under the noise floor in one of two runs.load cpu, 1.43 here and between 1.02 and 1.71 across seven runs on main, above 1.5 in two. The profile names an anonymous function ataddressable-names.js:187,headingsIn's query of every heading under an element, growing from 1 to 126 ms (exponent 1.54). Read from the code, not confirmed: each document's first draw may start a new page reading, whose heading queries walk the whole page again.matchesgrows at 1.13 in Chromium and 0.87 in Firefox, within its limit as awholeinput. Chromium's 2.3 s at 34 documents against Firefox's 0.29 s is Open page search without restyling the whole page #5999's note that a match's visibility read styles each run it lies in.search,dataandrevealstay level in both engines. In the first commitsearchran afterbrowseand grew with the tabsbrowseleft coloured (0.79!); run before it, it reads 17 to 20 ms.Each fix reverted in the working tree (
git revert --no-commit), with--base HEADfor main beside it. The #5992 and #5999 rows are from the first commit's page, which held one document fewer:data KBgoes 164, 736, 1,398, 2,722 KB with the fix reverted, exponent 1.08!; main reads 82.6 KB at every size.reveal:reveal cpugoes 48, 50, 63, 84 ms with the fix reverted, exponent 1.25!; main reads 48, 43, 51, 49 ms. On the first commit's page, whoserevealreopened the first tab for its second sample, the revert read 1.77!. In Firefox the revert raisesreveal cputo 210–290 ms at every size from 60–90 ms, level rather than growing, since the Firefox half of Open a closed tab without walking every panel's document #5996 (the fold rule) scaled with the opened document's length, which this page holds fixed.search cpugoes 45, 83, 92, 165 ms with the fix reverted, exponent 0.82!; main reads 26, 30, 28, 24 ms.CI time
The daily job measures
documentsin a step of its own after the default pages, with only these five inputs, since thedocumentpage's text already grows under every other input. The step runs after a failed one, and the readings to chart are collected once both have run, so one page's failure keeps the other's chart. Its table goes todocuments.txtin thebench-reportartifact, which Tend's benchmark review (.claude/skills/running-tend/SKILL.md) now names beside the browser and server tables. The command took 266–284 s here. To scale it to the runner: therowspage with the daily job's arguments took 397 s here and 7.5 minutes on the runner on 2026-11-14, a ratio of 1.13, while the runner's load CPU is 2.2 times this Mac's. So the job should grow by between about 5 and 10.5 minutes, nearer the first, since most of a run is waiting rather than CPU.Not verified
ContentClock) reads macOS's thread times, so the daily job reads Chromium only, and a Firefox-only cost such as Open page search without restyling the whole page #5999's shows only in a local run.No
dev/testssmoke test: the bench has none, and each input ran here in both engines at four sizes.Calls Max may reverse
heldcovering requests and bytes, withInput.wholeto exempt a revision and a search.2 + n/8documents.browse's 16 steps, which over two runs fitted 0.96 and 1.04 where three runs of 8 fitted 0.49 to 0.75.Part of #5194.