Repository navigation
bench: monthly standings - #1731
Merged
Merged
Conversation
ssalbdivad
added a commit
that referenced
this pull request
Nov 19, 2026
… failure shares ba691ac gave a failure its errors' summary as `message`, written as `get message()` in the failure's literal so that a consumer reading issues alone writes no summary. That getter is a function of its own for each failure, and V8 kept every failure built that way in dictionary mode: none shared a shape. Building the result then cost more than finding the issues. On schemabenchmarks.dev's invalid product (`~standard.validate`, the result unread; instructions per call on an Apple M5, one case a process as the suite's harness counts them): 2071002, before the message 29,613 854c05a 61,394 here 29,541 with no message at all 25,716 The hosted run behind #1731 counted the same doubling on x86 (29,186 to 61,814), which took the row from 2nd of 17 to 7th. A failure is now `{ issues }` with two properties defined on it: `_s`, a function writing its errors' summary, and `message`, an accessor whose getter is one function for every failure and calls `_s`. It is still the failure's own, enumerable and unwritten until read: Object.keys, a spread and JSON.stringify see it as before, and none of them sees `_s`, which isn't enumerable. `message` is no longer configurable. What it is not, and why: - Not written from `this.issues`. Each errors class writes its own summary, and arktype's writes it in the locale its errors were read in, which the issues don't hold. A summary written from issues alone would be the precompiled runtime's English lines for a Type that traverses under another locale. - Not the errors themselves in `_s`. A failure kept in a reactive store is read through a proxy that wraps each object it returns, and arktype's errors can't tell their own errors through one ("Only errors validation returned can be written again"). A function is returned as it is. For the same proxies `_s` is writable: one may not return another value for a property that is neither writable nor configurable. - Not a WeakMap from the failure or its issues to the errors: 45,900 and 62,800 instructions. - Not one define. Each Object.defineProperty is about 1,900 instructions. A symbol-keyed `_s` in the literal needs only `message` defined and counts 27,200, but the key is enumerable, so it is printed, copied and compared with the failure, and it is 10 bytes more gzipped. Object.defineProperties with both is 31,500. The precompiled runtime builds a failure in arktype/runtime's standardResultOf and arktype in @ark/schema's standardFailureOf, the same eight lines twice. arktype/runtime can't import @ark/schema's without costing bundles that hold neither: esbuild's minifier numbers a bundle's names past each name a live import statement lists, used or not, and one more moved the Valibot login form's export from `lo` to `co`, 917 to 918 bytes gzipped, though the form holds no `~standard`. Written in place the form is byte for byte what it was. Bytes, min / gzip. Unchanged: the Valibot login form 1,871 / 917 (smallest 1,699 / 878) and schemabenchmarks.dev's download 5,568 / 1,547, neither of which holds `~standard`. The homepage's apps, which do: default login 2,333 / 1,140 -> 2,442 / 1,177 moltar 3,003 / 1,188 -> 3,112 / 1,228 shop 20,764 / 5,074 -> 20,873 / 5,115 smallest login 1,934 / 998 -> 2,043 / 1,038 moltar 2,212 / 1,132 -> 2,321 / 1,171 shop 7,774 / 3,420 -> 7,883 / 3,464 Tests: the message isn't written until it's read and every failure's getter is the same function; a failure read through a wrapping proxy writes its message; testV8 holds failures to fast properties and one map, which 854c05a's fail.
ssalbdivad
added a commit
that referenced
this pull request
Nov 19, 2026
…ithout a Map 3e27c4e made errors that wait to be read the class a build writes (findsOnRead), and left every other runtime, a dev server's, an unpruned build's or a library another build precompiled, waiting as before: through a class beside the errors', built at a class's first failure. Before it that class was a module variable for ArkErrors. After it every class's was looked up in a Map on each failing call, and the lookup was nearly half of what a call that leaves its errors unread costs. ArkErrors' class is a module variable again, and the Map holds only the others'. On schemabenchmarks.dev's invalid product (`schema(data)`, the result unread; instructions per call on an Apple M5, one case a process), in the unpruned build the suite's counted arm was: 2071002 132.7 854c05a 254.7 here 138.9 That arm is what the hosted run behind #1731 counted at 261.3 where 2071002's was 144.2, losing the row to zod-compiler's 250.3. A pruned build never ran this code: it folds findsOnRead and holds no class beside its errors', so the Valibot login form (917 B gzipped) and schemabenchmarks.dev's download (1,547) are byte for byte what they were.
ssalbdivad
added a commit
that referenced
this pull request
Nov 19, 2026
…s download arm is The suite has two ArkType arms built apart: the download test's bundle, which reproduce.ts builds with ARK_OPTIONS, and the module every speed row runs, which sb/precompiled/generate.ts builds with tsdown. A tsdown build can't tell the plugin it's a production build, so generate.ts spells out what one defaults to. It listed @ark/aot's productionDefaults and not prune, which a production build also has unless it's set false and which the download arm passes. So the speed rows were counted on a build nobody ships by default: its runtime was arktype's as written, not as a build writes it for what the module reads. Until 3e27c4e the two ran the same code on a failing call. Since it, only a pruned build's errors find their own issues when read, and the unpruned arm paid a lookup per failure (the commit before this one). With prune the arm's "parsing invalid" row counts, on an Apple M5, one case a process: 2071002 132.7 854c05a, unpruned 254.7 here, pruned 145.5 13 instructions over 2071002, about what the deferral's rework was measured to add (11, from 195 to 206 on the moltar app), where the unpruned arm added 122 here and 117 in the hosted run behind #1731. Every other row of the arm is within 0.1% of what it was, and each of its 19 cases still returns what allChild.ts's check expects. Every other counted arm already builds for production, and so prunes: moltar/build.ts, ata/build.ts, sury/bundle.ts, sb/bundle.ts, startup.ts and forms/size.ts all bundle with esbuild's "production" condition, which the plugin reads. None of them changed.
ssalbdivad
added a commit
that referenced
this pull request
Nov 19, 2026
… result The hosted run behind #1731 took 62 minutes to count every library, and what it found wrong was ArkType's: two rows, both fixed in the three commits before this one. Measuring that fix shouldn't mean measuring 668 rival arms again. A rival's count changes with its release, not with the run: that run's host, an Intel Xeon under KVM, counted 0.973 to 1.002 of what the stored i7 did on the 10 schemabenchmarks.dev arms on the same suite commit and release, and 0.999 to 1.001 on the 17 of ArkType's own rows its code hadn't changed. `pnpm benchExternal <suite> --newest --arktype-only`: - installs each suite from its own lockfile, with no rival moved to a newer release, and for moltar's compiles none of the rivals' cases, which ArkType's arms don't load - counts only the arms whose label names ArkType (54 of 722: moltar's 4, schemabenchmarks.dev's 38, Sury's 4, ata's 8). count.ts resumes from its out file, so that file starts as the rivals' stored counts - runs the size scripts as they are, since each measures every library in one pass, and takes only ArkType's entries from what they write (newest.ts's carriedWith, by a label at any depth or an element's libraryName) - counts startup.ts whole: it installs nothing, and its wins pair every arm by round - keeps each suite's day and installs in run.json, which are its rivals', and records ArkType's commit and `arkTypeDate`. The leaderboard's "measured" is unchanged in meaning: the rivals' day and ArkType's commit It throws where results/newest has no run to keep, rather than counting ArkType against nothing. The workflow takes `arktype_only`. The rivals' results it keeps are the last run's, and while that run's pull request is open they are on its branch, not the one measured. So the run reads results/newest from `bench/monthly-standings[-<branch>]` into the working tree, leaving the index at the branch's head: monthly.ts then reports every change from the branch, the rivals' as that run found them and ArkType's as this one did, and publishes all of it to the same branch, so the open pull request is rewritten whole. Where no such branch exists the results are the ones checked in. The pull request says first that only ArkType was measured again, at which commit, and which day's run every rival's result is carried from. run.json's commit is nine digits again. `git rev-parse --short` picks a length by how many objects the clone holds, and the runner's shallow one wrote seven. Dry run on a Mac, with stand-ins for taskset and perf (the stand-in counts the child's retired instructions with proc_pid_rusage) and results/newest read from #1731's branch: 4 minutes 40 seconds against 17 for every library there. Every rival's leaf in every stored file was unchanged but startup.json's, every ArkType count was replaced, no install of a newer release ran, and monthly.ts wrote the body with the carry stated first.
Written by .github/workflows/leaderboard.yml's rerun of the benchmarks a hosted runner measures, with each rival at its newest release: https://github.com/arktypeio/arktype/actions/runs/44620007851. Its pull request says what changed.
github-actions
Bot
force-pushed
the
bench/monthly-standings-featherduster
branch
from
November 19, 2026 21:49
a75b521 to
7732e41
Compare
ssalbdivad
added a commit
that referenced
this pull request
Nov 19, 2026
… does, or not at all The run behind #1731 committed an llms-full.txt without eleven lines twoslash adds: ten "// TypeScript: ..." errors and one hover. `pnpm buildDocs` on the same tree put them back (6dc5793). The benchmarks in between had nothing to do with it: at a clean, fully built checkout, with no benchmark run, node -e 'import("./ark/docs/lib/writeMarkdown.ts").then(m => m.writeMarkdown())' from the repo root, which is what monthly.ts ran, drops the same eleven lines in about a second, and from ark/docs it changes nothing. Two things had to line up. twoslash resolves a snippet's imports from its vfsRoot, which defaults to process.cwd(). arktype and its companions are installed under ark/docs/node_modules and not at the repo root, so from the root none of them resolved and every snippet's types were `any`. `next build` starts in the docs, so the docs build never saw it. The twoslasher now names the docs as its root, whatever directory the process started in. The guard from 0c6d0c9 did catch it: it threw "const User: ..." has no type for the first snippet. But codeForMarkdown only rethrows in a production build, so that a broken snippet doesn't take down `next dev`, and otherwise writes the snippet with its twoslash directives stripped. monthly.ts never set NODE_ENV, so every snippet with `// @errors` or `// ^?` was quietly written without what twoslash adds. The baseline step wrote the same degraded text, so the files the numbers didn't touch (docs/regex/llms.txt, which loses its hovers the same way) compared as unmoved and were restored, and only llms-full.txt, which the numbers did change, was committed with the loss. monthly.ts now writes the text as next.config.ts has it written: in ark/docs and with NODE_ENV=production. A snippet whose types don't resolve, or a page tree with errors, fails writeMarkdown there, and the pull request's body says the text was "Not written again" and that the run's log has why, as it already did for a writeMarkdown that failed. Checked by running the steps in a temp dir with twoslash's cache cleared: - `monthly.ts baseline` keeps nothing, where before it kept llms-full.txt and docs/regex/llms.txt - `monthly.ts report` after changing one number in presetScale.json writes no checked-in text differently - the same with ark/type/out/index.d.ts hidden leaves the text as checked in and the body reads "Not written again" The new test in markdown.test.ts is the first snippet that lost its error. Mocha starts at the repo root, so without the vfsRoot it fails on a cold cache, as CI's is. A warm one (ark/docs/node_modules/.cache/ark-docs/twoslash) hides it, since a result's key doesn't have the directory in it and a degraded result is never cached.
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.
Only ArkType was measured again, at
591cc38d7(featherduster) on 2026-11-19 onubuntu-24.04. Every rival's result is carried from the run of 2026-11-19, at the versions that run installed ("Versions" below), and wasn't measured again: a rival's count or bundle changes with its release, not from one run to the next.startup.tsinstalls nothing and pairs its arms by round, so every arm of it was counted. Nothing is published until this is merged.CI hasn't run here: a pull request opened with the workflow's token triggers no other workflow. Close and reopen it, or push to
bench/monthly-standings-featherduster, to run the checks.Versions
effecttypiattscata-validatortypiattsc@ttsc/unplugin@sx3/gateata-validatorpure-parsetypiavalibotzodata-validatortypiazodttscEvery install
@sinclair/typeboxajvajv-errorsajv-formatseffectjoiruntypessuperstructvalibotyupzodtypiattscata-validatortypiattsc@ttsc/unpluginzodvalibot@sx3/gateata-validatorpure-parsetypiavalibotzodata-validatortypiazodttscNumbers that changed
The leaderboard's results (
ark/docs/lib/bench/leaderboard.json), where each rival keeps the better of its installs:parseSafeArkTypeparseSafeTypiaparseSafe@sx3/gateparseSafepaseriparseSafeZod (compiled)parseSafesuryassertLooseArkTypeassertLooseTypiaassertLoosesuryassertLoosepure-parseassertLoosetype-predicate-generatorassertLoosestnlassertStrictArkTypeassertStrict@sx3/gateassertStrictsuryassertStrictts-runtime-checksassertStrictspectypesassertStrictTypeBoxparseStrictArkTypeparseStrictTypiaparseStrictsuryparseStrictpure-parseparseStrictts-runtime-checksparseStrictTypeBoxformArkTypeformValibotformZodformZod (compiled)formZod MiniloginArkTypeloginValibotloginZodloginZod (compiled)loginZod MiniloginTypialoginajvloginTypeBoxmoltarArkTypemoltarValibotmoltarZodmoltarZod (compiled)moltarZod MinimoltarTypiamoltarajvmoltarTypeBoxshopArkTypeshopValibotshopZodshopZod (compiled)shopZod MinishopTypiashopajvshopTypeBoxparsing invalidpaseriparsing invalid@railway-ts/pipelinesparsing invalid@sapphire/shapeshiftparsing invaliddecodersparsing invalidio-tsparsing invalidruntypesparsing invalidsuryparsing invalidTypeBoxparsing invalidTypiaparsing invalidValibotparsing invalidYupparsing invalidZodparsing invalidZod (compiled)parsing invalidZod Miniparsing invalidZod 3parsing invalidArkTypeparsing validpaseriparsing valid@railway-ts/pipelinesparsing valid@remix-run/data-schemaparsing valid@sapphire/shapeshiftparsing validataparsing validdecodersparsing validio-tsparsing validJoiparsing validruntypesparsing validSuperstructparsing validsuryparsing validTypiaparsing validValibotparsing validYupparsing validZodparsing validZod 3parsing validzod-compilerparsing validArkTypestandard valid@railway-ts/pipelinesstandard valid@remix-run/data-schemastandard validatastandard validdecodersstandard validEffect Schemastandard validJoistandard validsurystandard validTypiastandard validValibotstandard validYupstandard validZodstandard validZod Ministandard validZod 3standard validArkTypestandard invalidpaseristandard invalid@railway-ts/pipelinesstandard invalid@remix-run/data-schemastandard invalidEffect Schemastandard invalidJoistandard invalidsurystandard invalidTypiastandard invalidValibotstandard invalidYupstandard invalidZodstandard invalidZod (compiled)standard invalidZod Ministandard invalidZod 3standard invalidzod-compilerstandard invalidArkTypestring date-time valid@railway-ts/pipelinesstring date-time validatastring date-time validJoistring date-time validsurystring date-time validTypeBoxstring date-time validYupstring date-time validZod Ministring date-time validZod 3string date-time validArkTypestring date validpaseristring date valid@railway-ts/pipelinesstring date valid@sapphire/shapeshiftstring date validajvstring date validsurystring date validTypeBoxstring date validTypiastring date validValibotstring date validZodstring date validZod Ministring time validpaseristring time valid@railway-ts/pipelinesstring time validajvstring time validTypeBoxstring time validTypiastring email validpaseristring email valid@railway-ts/pipelinesstring email valid@sapphire/shapeshiftstring email validajvstring email validJoistring email validsurystring email validTypeBoxstring email validYupstring email validZodstring email validZod 3214 more rows are in the run's artifact.
Each place and geometric mean that moved on the board, by the rule the headline follows (
standings.ts, which runsark/docs/lib/bench/units.ts):ArkTypeTypiaValibotTypeBoxZodArkTypeValibotsuryZodZod (compiled)Claims
Every claim holds on the new numbers, as before. Of those
ark/docs/lib/bench/headline.tslists, these 2 read differently:speedAveragestartupAverageEvery claim, after
Not rerun
pnpm benchExternal all --newest, or this workflow withoutarktype_only, measures each again at whatever its newest release then is.startup.tswas counted again, but it bundles the repo's own dependencies, so each rival is at the versionpnpm-lock.yamlpins.pnpm benchValidate,pnpm benchImport) and build times (pnpm benchBuildTime): wall clock, which on a shared runner measures the neighbors. Rerun them on a quiet machine.pnpm benchSizeScale): bundle bytes, so any machine measures it, but its peak of 13 GiB of memory is more than a hosted runner's 16 GiB leaves it. It takes about half an hour.Generated text
The docs build writes these from the numbers (
ark/docs/lib/writeMarkdown.ts), and they're written again here:ark/docs/public/docs/precompile/llms.txt,ark/docs/public/llms-full.txt,ark/docs/public/llms.txt.ark/docs/public/llms-full.txtalready trailed its sources at591cc38d7, so its diff holds that too. Any other file the docs build would rewrite at that commit is left as it is.The raw results' changes and the standings were too long for a pull request's body: they're in the run's artifact.
The run, with every file it wrote as its
leaderboardartifact.