Skip to content

What Netweir is

Netweir is a crawling and extraction framework, and the reason Parsec exists. I wrote the HTML parser for it, because I wanted something faster than Lexbor underneath a crawler, and the parser grew into Parsec. Since Netweir 0.12.0 it ships on Parsec's released crates, parsec-web-core, parsec-xpath and parsec-js, from crates.io like anyone else's project would. A fix to the parser lands in Parsec first and reaches Netweir with the next Parsec release.

The weekly run

Every Monday, Netweir's CI fetches 300 pages from a pinned list of 2,709 production URLs, a different slice each week, and parses each one with Parsec and with html5ever. If Parsec panics, hangs, or builds a tree html5ever disagrees with, the run fails. The list mixes the top sites' home pages with Wikipedia in 33 languages, docs, news, forums, shops, government sites and pages in legacy encodings.

That's the third layer of Parsec's testing, after its own unit tests and the standards suites. It catches what neither of the others can: the encoding a server lies about, the markup nobody writes on purpose, a news home page of 13.8 MB.

What it doesn't prove

A run that passes says Parsec didn't crash, didn't hang and agreed with html5ever on those 300 pages that week. It doesn't say Parsec is right where both parsers are wrong, and it isn't a conformance suite; Standards covers that. Netweir's own tests also exercise its whole pipeline, fetching and extraction included, so a failure there isn't always the parser's.

The same pages, as a benchmark

One day's crawl of that list, 1,731 pages that came back as HTML, is also the real-world benchmark: Parsec at 933 MB/s, Lexbor at 523, neither crashing on any page. The Real-world benchmarks page has the method, and the repository keeps the list of URLs and hashes, never the pages, which belong to their sites.

Found a page Parsec gets wrong?

Send it. A page that breaks the parser becomes a test that keeps it fixed, and that's the most useful thing anyone can give the project. Contributing says how.