Skip to content

Where Lexbor is ahead

  • Years in production. Lexbor has been released since 2018. It's inside PHP 8.4's Dom\HTMLDocument, selectolax and nokolexbor, and by its own account it's been run against 200 million pages under AddressSanitizer. Parsec's first release was in November 2026.
  • A bigger DOM. Lexbor can set an element's text, clone and import nodes, look them up by id, class or attribute, and call you back on changes. Parsec's tree has none of those yet: you find nodes with selectors or XPath and edit them directly.
  • Some pages, some workloads. Across 1,731 production pages, Lexbor parsed 13 faster than Parsec, nearly all of them small. Its decoders, on their own, beat Parsec's on dense GBK text.
  • Packaging. You can install Lexbor from vcpkg, Homebrew and Debian today. Parsec is on crates.io, PyPI and npm, with C packages on GitHub.

What each one has

Lexbor's column is its source at commit 145872a, from 26 October 2026, and Parsec's is the release on crates.io. The module-by-module comparison links every Lexbor claim to the line it comes from; if one's out of date, tell me and I'll fix it.

WhatLexborParsec
Parses HTML by the WHATWG standard, whole, in fragments or in chunksYesYes
Streams bytes, sniffing the encoding as they arriveNo: it takes the whole pageYes, the same document for any split
Parse errorsWith spec ids, as pointers into the inputWith the spec’s names, byte offset, line and column
A source position on every node and attributeNoYes
Limits for hostile inputNoneA time budget, a size cap and a depth limit
CSS selectorsLevel 4, with some pseudo-classes that parse and never matchLevel 4, matched as a browser would on a static page
XPathNoXPath 1.0
URLsYes, no web-platform-tests count publishedYes, every web-platform-tests case passes
Typed CSS values105 propertiesAll 822 in the specs
Cascade and computed valuesStyles attached; no media queries or computed valuesYes, with media queries against an environment you give
DOM: set text, clone, import, look up by id, mutation callbacksYesNot yet
PythonThrough selectolax, maintained by othersIts own package, with selectolax’s API, XPath and positions
Packagedvcpkg, Homebrew, Debian and morecrates.io, PyPI and npm, and C packages on each release

Two things Parsec does that the table can't show well: its documents can be shared between threads, which Lexbor's can't, and a node id never dangles after its node is removed, where Lexbor hands out raw pointers. Both are true of the code today, but no test checks them yet, so I'm not counting them as finished.

Speed and memory

Lexbor 3.0.1, built with its own Release flags, against Parsec in the same process on the same input, on an Apple M2 Max (12 cores, 32 GB), macOS 26.7:

  • Thirteen real pages: 370 MB/s against 242, 1.53 times as fast, with less memory on every page.
  • 1,731 production pages as a crawler fetched them: 933 MB/s against 523.
  • 32 selectors over the thirteen pages: 226 ms against 728.
  • 80,000 unclosed <div>s: Parsec at 131 MB/s, Lexbor at 5.2 s a parse, because its work there grows with the square of the depth.

Those are my runs, not anyone else's. Benchmarks has every table and How it's measured has the method and the commands, so you can check them.

Moving from Lexbor or selectolax

If you use Lexbor through selectolax, Parsec's Python package keeps selectolax's API, so the calls you already make keep their names. The docs' Moving from Lexbor page maps the C API call by call.