html5-parser

Languages and libraries

html parsing library

SHOW HN2017

169points
71comments
#215of 2,242 in 2017
Top 10%of 2017 by points

How HN took it

CuriousMostly questions and neutral comments

4 positive, 15 neutral or asking, 1 mixed, 3 critical, out of 23 comments about the project. Thread score +0.09.

Execution: 1 for, 1 againstIdea: 1 for, 1 againstPrivacy: 0 for, 1 against

The thread, comment by comment

Each row is a top-level comment and its replies, in HN's order. Select a cell to open that comment on HN.

positive neutral or mixed critical about another commenter or something else the maker

What HN said

What people liked

  • Speed claimed about 30x faster, with benchmarks linked

    From 1 comment
    • https://html5-parser.readthedocs.io/en/latest/#benchmarks
      aumerle on HN
  • Good documentation on safety and correctness

    From 1 comment
    • My favorite part about this documentation is actually the "Safety and correctness" section: https://html5-parser.readthedocs.io/en/latest/#safety-and-correctness It shows that a…
      zer01 on HN
  • Follows HTML5 spec, matching browser output on malformed HTML

    From 2 comments
    • I have not tested it, but it is probably slower. The advantage of this is that is follows the HTML 5 parsing spec, so it gives you the same results as a browser when parsing…
      aumerle on HN
    • As permissive as html5lib, which is as permissive as a modern browser, since both are base don the HTML 5 parsing spec.
      aumerle on HN

Objections

  • Bundled C code raises memory safety and buffer overflow concerns

    From 2 comments
    • No, no. I don't want some complicated C blob in the middle of my Python system. I don't have time to chase buffer overflows and pointer bugs. Has anyone benchmarked this against…
      Animats on HN
    • If just the tokenizer was in Rust, that might help. Much of the HTML5 error handling involves dealing with malformed tokens. Comments that begin "<-" instead of "<--". All that…
      Animats on HN
  • Performance claims lack independent tests and comparisons with lxml

    From 2 comments
    • Where are the test that show it's 30x faster? Otherwise, pretty cool. I only do occasional HTML parsing in scripts, so whatever is builtin and BeautifulSoup is good enough for…
      metalliqaz on HN
    • How fast is compare to lxml with the HTML parser ? I know that lxml won't parse as many cases as this module, but in many cases lxml can do the job.
      dalf on HN
  • Bundled gumbo fork complicates maintenance

    From 2 comments
    • Why does it bundle a copy of the gumbo library instead of just linking to it?
      pwdisswordfish on HN
    • If I understand things correctly, gumbo in html5-parser was forked from https://github.com/Sigil-Ebook/sigil-gumbo/ at 0830e1145fe08758d6ef24f77dfcbeac4633676f, which in turn was…
      sebcat on HN

Requests

  • Benchmarks against lxml and other parsers

    From 2 comments
    • How fast is compare to lxml with the HTML parser ? I know that lxml won't parse as many cases as this module, but in many cases lxml can do the job.
      dalf on HN
    • Would also be nice to see a performance comparison with other libraries, e.g. Go's html.Parse
      ernsheong on HN
  • Bindings for other languages such as Go, Ruby or Java

    From 1 comment
    • Would it be possible to interface this with other languages? e.g. Go, Ruby, Java, or is there a hard dependency on Python?
      ernsheong on HN
  • Integration with BeautifulSoup

    From 2 comments

Questions

  • How does it stay fast with two tree transformations?

    From 1 comment
    • 30x is quick! But still it doesn't appear to be sequential parser. html -> gumbo parse tree -> lxml tree What makes it efficient even with two tree transformations ? Is one of…
      samblr on HN
  • Why bundle gumbo instead of linking to it?

    From 1 comment

Alternatives named

  • html5lib

    From 2 comments
    • No, no. I don't want some complicated C blob in the middle of my Python system. I don't have time to chase buffer overflows and pointer bugs. Has anyone benchmarked this against…
      Animats on HN
    • This would replace html5lib in BeautifulSoup nicely :)
      jszymborski on HN
  • lxml

    From 2 comments
    • How fast is compare to lxml with the HTML parser ? I know that lxml won't parse as many cases as this module, but in many cases lxml can do the job.
      dalf on HN
    • You do know that by default bs4 uses lxml.html to do its parsing, which is also a big blob of C, right? For example, running the following: BeautifulSoup('<p>a')…
      aumerle on HN
  • html5ever (Rust)

    From 2 comments
    • [I was the original author of much of html5lib] Yes, http://speed.pypy.org/comparison/ has html5lib parsing (an old, static copy of) the HTML5 spec as a benchmark. It's about 3x…
      jgraham on HN
    • > My ideal solution here would be bindings to a Rust parser e.g. html5ever Funny how somebody submitted exactly this on HN a few hours ago :…
      littlestymaar on HN
  • gumbo-parser

    From 1 comment
    • I made a pull request[1] for gumbo-parser a while ago. While it is a wonderful project, it seems to be in need of a new maintainer, or a maintained fork. [1]…
      sebcat on HN

Category, keywords, summaries and labels on this page were made by AI (Thread Reader v2) and not checked by hand. Each point links to the comments it came from.

Add a badge to your READMEShown on HackerShow
[![Shown on HackerShow](https://hackershow.org/badge.svg)](https://hackershow.org/show/14588333)