Skip to content

Real world benchmarks

James Conway edited this page Nov 22, 2026 · 1 revision

Parsec, Lexbor and html5ever, run over 1,731 production pages as a crawler fetches them. Each parser gets the raw bytes and the Content-Type charset. Parsec gets through the corpus at 933 MB/s and Lexbor at 523, so Parsec is 1.78 times as fast. Parsec's median page takes 0.20 ms and Lexbor's 0.35 ms. Neither parser crashed or timed out on any page, and the three parsers built the same number of elements on every page. Lexbor is faster on 13 pages, nearly all of them small, and html5ever's process peaks 2 MB lower than Parsec's. The tables below have the rest, broken down by encoding, by language and by size.

Note

These are one machine's numbers: an Apple M2 Max (12 cores, 32 GB), macOS 26.7.2 (Darwin 25.6.0), Rust 1.100.0, on 21 November 2026, with Parsec at 7006d31. The parsing itself takes about five seconds per run. Most of the wall time goes on waiting for a quiet machine.

Why this page exists

The Benchmarks page times 13 hand-picked pages and the final boss's seeded batch. Both are chosen. This page is the web as it came back from a crawl on one day, with nothing chosen and nothing tidied. That covers the Shift_JIS novel and the 13.8 MB news home page as well as the 300-byte redirect stub that some sites serve as their home page.

The corpus

The pages come from Netweir's real-world harness, bench/realworld/ in netweir/netweir. Its pick.py chose two kinds of URL:

  • Home pages from Tranco list 46YVX, made on 20 November 2026. These come from the top 100,000 pay-level domains. Each public suffix gets a share of picks that grows with the square root of how many of those domains it has, so .com doesn't crowd out .de, .co.jp or .gov.uk. CDNs, trackers and adult sites are left out by name.
  • Inner pages picked by hand for the kinds of page a home page isn't: articles, docs, forum threads, product pages and legacy encodings.

Netweir's run.py fetched all 2,709 listed URLs on 21 November 2026. It followed robots.txt for every redirect, sent one request at a time to each host with a second between them, and named the project in its User-Agent. Of those URLs, 1,731 came back as 200 HTML: 1,417 home pages and 314 inner pages, 558.6 MB in all, with 1,686 distinct bodies. Some URLs redirect to the same page. The rest were left alone for robots.txt (97), were unreachable (564), returned a status other than 200 (313), or weren't HTML (4).

bench/realworld.tsv lists each page's URL, the SHA-256 of the body after Content-Encoding, the time it was fetched (UTC) and its Content-Type header. The pages belong to their sites, so the repository holds this list and never the bodies.

The method

cargo run --release --manifest-path bench/Cargo.toml -- realworld reads the list and the bodies in bench/corpus/realworld/, which are named by their SHA-256. Each page goes through the final boss's machinery:

  • Parsec: parsec_encoding::parse_bytes, with Options::transport set from the charset in Content-Type. That's the browser's algorithm: BOM, transport, prescan, UTF-8 detection, windows-1252, and a second parse if a later <meta> changes the encoding.
  • Lexbor 3.0.1, built from its release tag: its own BOM sniff, the transport label, its <meta> prescan of the first 1,024 bytes, then windows-1252. Lexbor's encoding module decodes anything that isn't UTF-8, and then lxb_html_document_parse parses the result. UTF-8, and ASCII in an encoding that keeps ASCII, go straight to the parser.
  • html5ever 0.40.1 takes text, so encoding_rs decodes the bytes for it first, using Parsec's sniffing and no second parse. That decode is inside its time.

Each parser runs in its own processes. A feeder process sends the pages one at a time over a pipe to a worker. The worker times each page from bytes to a finished document, then counts its elements and frees it outside the timed part. A page still parsing after 10 seconds counts as a timeout. A crash or a timeout costs that one page, and a new worker picks up at the next one. Peak RSS is getrusage(RUSAGE_CHILDREN)'s ru_maxrss across one parser's workers. It includes the one buffer each worker reuses for every page, which grows to the biggest page, 13.8 MB.

Each parser does three runs. Before each run the bench waits for the one-minute load average to drop below 3, and a different parser goes first each time. A page's time is the median of its three runs. A parser's total is the median of its three run totals. MB/s is bytes over that total. In the breakdowns, MB/s is a group's bytes over the sum of its pages' median times.

Each page is parsed once per run, the way a crawler meets it, not 30 times on a warm cache as on the Benchmarks page. Expect noisier times on small pages here, and higher MB/s on big ones. Many of the big pages are mostly script or JSON in a few text nodes, and every parser gets through those fast.

Results

Parser Total MB/s p50 p90 p99 Slowest Peak RSS Crashes Timeouts Refused
Parsec 0.60 s 933 0.20 ms 0.74 ms 2.73 ms 7.35 ms 101 MB 0 0 0
Lexbor 1.07 s 523 0.35 ms 1.40 ms 5.00 ms 15.83 ms 123 MB 0 0 0
html5ever 3.49 s 160 1.12 ms 4.65 ms 14.64 ms 40.67 ms 99 MB 0 0 0

p50, p90 and p99 are per-page times across the 1,731 pages. Slowest is the single slowest page.

Element counts: Lexbor and html5ever each built the same number of elements as Parsec on every page. None of the three refused a page, crashed or timed out. The load average was 2.45 to 2.90 at the start of each run.

By encoding

Pages MB Parsec MB/s Lexbor MB/s html5ever MB/s Parsec vs Lexbor
UTF-8 1508 538.9 964 529 161 1.82x
windows-1252 207 16.9 1659 608 252 2.73x
Shift_JIS 8 1.6 252 125 70 2.01x
windows-1251 3 0.3 225 99 62 2.27x
windows-1250 2 0.4 380 128 71 2.97x
ISO-8859-15 1 0.5 815 163 139 5.01x
windows-1256 1 0.0 42 39 21 1.06x
KOI8-R 1 0.0 134 75 40 1.78x

By <html lang>

Pages MB Parsec MB/s Lexbor MB/s html5ever MB/s Parsec vs Lexbor
en 955 279.8 1087 573 178 1.90x
none 180 29.6 708 395 135 1.79x
es 80 29.9 1066 494 174 2.16x
ja 58 27.8 1025 520 177 1.97x
ru 50 16.2 787 439 136 1.79x
pt 37 13.9 966 544 155 1.77x
de 36 22.2 844 470 128 1.80x
fr 27 12.7 1232 635 187 1.94x
zh 25 7.7 585 367 111 1.60x
ar 25 9.0 838 505 154 1.66x
tr 22 5.8 755 458 130 1.65x
ko 21 8.5 673 415 120 1.62x
id 17 3.1 706 425 120 1.66x
it 15 8.0 856 491 136 1.74x
vi 15 7.2 536 331 96 1.62x
pl 13 7.5 953 556 165 1.71x
uk 12 4.4 1126 616 198 1.83x
fa 9 3.3 720 514 152 1.40x
th 9 4.1 991 600 191 1.65x
nl 8 3.0 1215 615 188 1.98x
he 8 4.4 1169 599 189 1.95x
el 7 4.3 660 414 117 1.60x
cs 6 3.4 883 413 151 2.14x
da 6 3.2 979 568 147 1.72x
sv 5 2.0 879 509 136 1.73x
39 more 85 37.5 961 540 164 1.78x

By size

Pages MB Parsec MB/s Lexbor MB/s html5ever MB/s Parsec vs Lexbor
under 10 KB 140 0.5 301 198 76 1.52x
10-100 KB 599 36.7 716 410 131 1.74x
100 KB-1 MB 873 304.9 820 462 140 1.77x
1-10 MB 118 202.6 1365 674 213 2.03x
over 10 MB 1 13.8 2435 869 426 2.80x

Parsec's slowest pages

Page Size Encoding Parsec Lexbor html5ever
https://kqbd.mobi/ 2904 KB UTF-8 7.35 ms 11.57 ms 40.67 ms
https://web.nhk/ 13764 KB UTF-8 5.65 ms 15.83 ms 32.33 ms
https://nodejs.org/api/fs.html 1109 KB UTF-8 3.78 ms 5.23 ms 15.45 ms
https://ru.wikipedia.org/wiki/Москва 2116 KB UTF-8 3.76 ms 6.28 ms 19.58 ms
https://zh.wikipedia.org/wiki/北京市 1462 KB UTF-8 3.59 ms 5.15 ms 17.36 ms
https://www.aozora.gr.jp/cards/000148/files/773_14560.html 618 KB Shift_JIS 3.52 ms 6.07 ms 10.24 ms
https://cnn.com/ 7433 KB UTF-8 3.44 ms 8.23 ms 22.48 ms
https://ar.wikipedia.org/wiki/القاهرة 1900 KB UTF-8 3.43 ms 5.31 ms 17.78 ms
https://en.wikipedia.org/wiki/Tokyo 1961 KB UTF-8 3.42 ms 5.94 ms 18.81 ms
https://de.wikipedia.org/wiki/Berlin 1666 KB UTF-8 3.38 ms 5.50 ms 17.77 ms

Where Lexbor is faster

Lexbor parses 13 of 1731 pages faster than Parsec; Parsec spends 0.05 ms more than Lexbor on them in all. Those that lose the most time:

Page Size Encoding Parsec Lexbor html5ever
https://quickconnect.to/ 67 KB UTF-8 0.11 ms 0.10 ms 0.17 ms
https://mega.nz/ 3 KB UTF-8 0.03 ms 0.02 ms 0.05 ms
http://info.cern.ch/hypertext/WWW/TheProject.html 2 KB windows-1252 0.02 ms 0.02 ms 0.05 ms
https://www.cs.cmu.edu/~rgs/alice-table.html 3 KB windows-1252 0.02 ms 0.01 ms 0.04 ms
https://imss.gob.mx/ 0 KB windows-1252 0.01 ms 0.01 ms 0.01 ms
https://korea.ac.kr/ 1 KB UTF-8 0.01 ms 0.01 ms 0.02 ms
https://cuhk.edu.hk/ 0 KB windows-1252 0.01 ms 0.01 ms 0.02 ms
https://examinationservices.nic.in/ 1 KB windows-1252 0.01 ms 0.01 ms 0.03 ms
https://blackrussia.online/ 2 KB windows-1252 0.01 ms 0.01 ms 0.02 ms
https://www.jd.com/ 1 KB UTF-8 0.01 ms 0.01 ms 0.01 ms

html5ever parses 2 of 1731 pages faster than Parsec.

Element counts that differ from Parsec's

Lexbor: 0 pages.

html5ever: 0 pages.

Where Parsec loses

  • Memory, against html5ever. html5ever's workers peaked at 99 MB and Parsec's at 101 MB. Lexbor's peaked at 123 MB. That's one number per run, set by the biggest pages, so a 2 MB gap on 100 MB is close to a tie. Still, Parsec doesn't win it here, and on the Benchmarks page html5ever holds less memory than Parsec on four of the 13 pages too.
  • Tiny pages, against Lexbor. Lexbor is faster on 13 pages. The ten where Parsec loses the most are all under 70 KB, and most are under 3 KB. Parsec loses 0.05 ms on all 13 together, a few microseconds each, which is about the size of the timer's noise at this scale. The lead is narrowest under 10 KB (1.52 times, against 2.03 times from 1 to 10 MB). That's where fixed per-document costs weigh most.
  • windows-1256. On its one page Parsec is only 1.06 times as fast as Lexbor, and both parsers run far below their usual MB/s. A single page under 50 KB proves little, but it's the narrowest group in the tables.
  • Against html5ever on two pages. html5ever beat Parsec on 2 pages.

What this doesn't cover

  • One day of the web. Pages change by the hour. google.com served different bytes two hours later. Rerun bench/fetch-realworld.sh and some pages will have changed. Those are left out rather than replaced, so the comparison stays like for like.
  • Language comes from <html lang>, as the page states it. 180 pages have none, and some sites state the wrong one. The script family is not checked.
  • Encodings are as Parsec decided them. Lexbor's sniffing can land on a different encoding, for example when a page needs UTF-8 detection, which Lexbor 3.0.1 doesn't have. The element counts still agreed on every page.
  • The pages are mostly UTF-8. That is 1,508 of the 1,731. The legacy-encoding rows have few pages, and the final boss covers those encodings on purpose.

Running it

git clone --recurse-submodules https://github.com/parsec-html/parsec
cd parsec
bench/fetch-realworld.sh
cargo run --release --manifest-path bench/Cargo.toml -- realworld > report.md

bench/fetch-realworld.sh fetches the listed pages into bench/corpus/realworld/. It fetches the way Netweir's harness does: robots.txt for every redirect, one request at a time to each host with a second between them (or the Crawl-delay, up to 10 s), sixteen hosts at once, a 20 s timeout, and the User-Agent parsec-realworld/1.0 (+https://github.com/parsec-html/parsec). It keeps a page only if its SHA-256 still matches the list, and prints how many pages changed. The benchmark then reports how many listed pages it left out.

To build a fresh list from Netweir's bench/realworld/urls.txt, run bench/fetch-realworld.sh --urls urls.txt > list.tsv. That fetches every URL, keeps what comes back as 200 HTML, and prints new manifest lines. Then point the benchmark at it with -- realworld --manifest list.tsv. --runs N, --tools parsec,lexbor and --now (don't wait for a quiet machine) change the rest.

The tables above are the benchmark's output as it printed it. You need CMake and a C compiler for Lexbor, and Python 3.11 or later for the fetch script.

See also

Clone this wiki locally