Repository navigation
feat(bench): the figures parsec.tools quotes could only be copied by hand - #259
Conversation
…hand The bench printed tables and nothing else, so the website kept 27 figures typed in from the docs, and a new run meant retyping them. `--json PATH`, with any mode, now also writes every figure the run prints, one object per figure (bench, source, bytes, parser, metric, value), with the date, the commit, rustc, the machine, the load average when the run ended and each parser's version (schema 1, in src/results.rs). The tables it prints don't change. bench/results/2026-11-29-m2-max/ holds a full run made with it: the pages, selectors, URLs and CSS (pages.json), decoding, JavaScript, the JavaScript lexer, the final boss and the real-world corpus. Most of the real-world list's pages had changed since 21 November, so fetch-realworld.sh would have kept only a few hundred of them. realworld.tsv is a fresh fetch of Netweir's 2,709 URLs instead: 1,746 pages kept, 563.4 MB.
foothillsdigital
left a comment
There was a problem hiding this comment.
Approving acedf4d. I recomputed the table from the committed JSON, and it holds. Two small things, neither blocking.
The files back the table. From bench/results/2026-11-29-m2-max/*.json, as bytes / value for each seconds figure:
pages.json, "all real pages": Parsec 362, Lexbor 242, html5ever 83 MB/s.realworld.json, "1746 pages": Parsec 1,007, Lexbor 543 (html5ever 166) MB/s over 563.4 MB.boss.json,seconds_per_1000_pages: 0.99, 1.93 and 5.99.js.json, "all": Parsec 373, oxc 358, swc 156 MB/s.- The memory claim: of the 13 real pages'
peak_bytes, Parsec is above Lexbor on exactly the four you name:bbc-news(2.7 vs 2.6 MB),ebay(3.8 vs 3.6),nytimes(10.8 vs 7.3) andreddit-programming(4.0 vs 3.0). schema1, commit72d32f0, and a one-minute load of 2.56 inpages.json, inside the 1.8 to 3.2 you give.
1. One figure that moved isn't in the table. realworld.json has "pages Lexbor parses faster" = 8, and parsec.tools (realWorld.lexborFaster) and the docs' Real-world page both say 13 of 1,731. That's good news, but it's a third published claim this run changes, so it's worth listing beside the two you did, for whoever moves the site onto these files.
2. A failed gate writes no JSON. The file is written from Output's Drop at the end of main, and boss.rs:1349 ends a failing --smoke/--gate run with std::process::exit(1), which runs no destructors. (The exit(TIMED_OUT) at line 761 is in the child worker, which is fine.) So the one run whose figures you'd most want to inspect leaves none. Writing the figures before that exit, for example with a results::flush() the Drop also calls, or returning an exit code from main, would keep them. That's only if the gate is meant to be run with --json; if not, a line in results.rs saying so is enough.
The per-figure shape (bench, source, bytes, parser, metric, value), with the machine and the versions beside it, is easy to read from the site, and keeping html, html-generated and html-hostile apart is the right call.
|
Thanks for re-deriving the table. On your two points:
|
Problem
The bench prints tables and nothing else. So parsec.tools keeps 27 figures typed in by hand from the docs' Benchmarks pages, under two
shortcut:comments, and every new run means retyping them and hoping each sentence that cites one still holds.Change
--json PATHworks with any mode. Alongside the tables, which don't change, the run writes every figure it printed to PATH: one object per figure,{bench, source, bytes, parser, metric, value}. The file also carriesschema(1),date,args,commit,rustc,machine(CPU, cores, memory, OS, arch),load_averagewhen the run ended, and each parser'sversions. The format is inbench/src/results.rs, andbuild.rsadds the cssparser and rustc versions to what it already passes in.seconds(median),peak_bytes,ns_per_url,p50_secondstoslowest_seconds,seconds_per_1000_pages,disagrees_with_parsec,crashes,timeouts,refused,no_documentandpages. Real pages arehtml, generated oneshtml-generatedand hostile oneshtml-hostile, so a site can count each set on its own.bench/results/2026-11-29-m2-max/holds a full run with it, one file per mode:pages.json(HTML, selectors, URLs, CSS),decode.json,js.json,js-lex.json,boss.jsonandrealworld.json. It ran on an M2 Max, macOS 26.7.3, Rust 1.100, at 72d32f0, with the one-minute load between 1.8 and 3.2 as each mode finished.bench/realworld.tsvis a fresh fetch. Most pages on the 21 November list have changed since, andfetch-realworld.shkeeps only pages whose hash still matches, so a run on the old list would have covered a few hundred pages.fetch-realworld.sh --urlsfetched Netweir's 2,709 URLs again: 1,746 kept, 563.4 MB. The other 963 were refused by robots.txt (99), unreachable (562), returned a non-200 status (298) or weren't HTML (4).What the new run says, against the published figures
Two published claims don't hold in this run:
The lexer's lead over oxc is new since #249 and #253.
Tests
cargo build --release,cargo fmt, andcargo clippy --release -- -D warningsinbench/are clean, andscripts/check-headers.shpasses.