How it's measured
A benchmark you can't rerun is a claim. Here's what goes into these, so you can check them.
The machine
Every published run so far is on an Apple M2 Max (12 cores, 32 GB), macOS 26.7, with Rust 1.100. One machine is one machine: yours will give different numbers, and the ratios between parsers are what should hold. Each table on the Benchmarks page opens with the versions and the commit it ran at.
The parsers
| Parser | Version | How it's built and called |
|---|---|---|
| Lexbor | 3.0.1 | A git submodule at its release tag, built by CMake with its own Release flags (-O2), as a static library. |
| html5ever | 0.40.1 | Building markup5ever_rcdom's RcDom, the tree its own project tests with. |
| Ada | 4.0.0 | The URL parser in Node.js, compiled at -O3 with NDEBUG, its base parsed once, as the others' are. |
| cssparser | 0.38 | Servo's CSS tokenizer and parser, given the least work a caller would ask of it. |
| oxc_parser | 0.157.0 | A fresh allocator each parse, comments kept, as Parsec keeps them. |
| swc_ecma_parser | 47.0.0 | With no comment store, the least it can be asked to do. |
Each parser gets the same input, already in memory, in the same process. Where one does less work than another, such as swc keeping no comments or Lexbor parsing CSS values the others don't, the Benchmarks page says so beside the table.
The inputs
- Thirteen real pages: Internet Archive snapshots, fetched raw and checked against the SHA-256 hashes in
bench/pages.txt. The repository holds their addresses, never the pages. - 1,731 production pages: one day's crawl by Netweir's harness, home pages from a Tranco top-sites list and inner pages picked by hand for articles, docs, forums, shops and legacy encodings.
bench/realworld.tsvlists each URL and the hash of its body. - Hostile inputs: eight, from
crates/parsec/examples/hostile.rs, each in its own process with a two-minute limit, so a hang shows up as a hang. - The final boss: 1,000 pages generated from a seed. The same seed gives the same bytes, and the bench prints a fingerprint so you can check yours match.
- Stylesheets and scripts: pinned in
bench/stylesheets.txtandbench/scripts.txt, fetched and checked against their hashes.
Timing
For the in-memory tables, each parse gets three warm-up runs, then the median of at least 30; small pages get more, up to half a second's worth. Freeing the result isn't timed. MB/s is the input's size over that median, and a total is all the bytes over the sum of the medians, so big pages weigh most.
The production pages are different on purpose: each is parsed once per run, the way a crawler meets it, in three runs with a different parser first each time, after waiting for the machine's load average to drop below 3. A page's time is its median over the three. Expect that table to be noisier on small pages. The Real-world benchmarks page has the details.
Memory
Peak memory in the in-memory tables is how far the heap grew while one document was built and held. The bench's allocator counts every allocation, and Lexbor's malloc family is routed through the same allocator, so all three are counted the same way. Lexbor reserves memory pools up front, which is part of why its small pages look large. The production run and the final boss report each process's peak resident memory instead.
Run it yourself
git clone --recurse-submodules https://github.com/parsec-html/parsec
cd parsec
bench/fetch-pages.sh
cargo run --release --manifest-path bench/Cargo.tomlYou need CMake and a C compiler for Lexbor, and a C++20 compiler for Ada. Name pages to run only those, by any part of their name, and run on a quiet machine: a build or a browser in the background moves these numbers by a fifth or more. The first line of the output names the versions and the machine, so paste it whole when you send it to me.