Google Open-Sources Gumbo: C Library for Parsing HTML5
1–10 of 63 posts
Re: Google Open-Sources Gumbo: C Library for Parsing HTML5
#2PyPy JIT and html5lib is about 8x faster as it is cpython.
Re: Google Open-Sources Gumbo: C Library for Parsing HTML5
#3I would be quite interested in Gumbo as the backend to the awesome pure Python but otherwise rather-slow https://github.com/html5lib/html5lib-python , which actually has great whitelisting/cleaning facilities but is easily an order of magnitude slower than lxml's more limited clean_html. PyPy JIT and html5lib is about 8x faster as it is cpython.
Re: Google Open-Sources Gumbo: C Library for Parsing HTML5
#4I would be quite interested in Gumbo as the backend to the awesome pure Python but otherwise rather-slow https://github.com/html5lib/html5lib-python , which actually has great whitelisting/cleaning facilities but is easily an order of magnitude slower than lxml's more limited clean_html. PyPy JIT and html5lib is about 8x faster as it is cpython.
From a quick glance, it looks like you'd need to make Gumbo a backend for lxml. Is that even possible?
Re: Google Open-Sources Gumbo: C Library for Parsing HTML5
#5Re: Google Open-Sources Gumbo: C Library for Parsing HTML5
#6I would be quite interested in Gumbo as the backend to the awesome pure Python but otherwise rather-slow https://github.com/html5lib/html5lib-python , which actually has great whitelisting/cleaning facilities but is easily an order of magnitude slower than lxml's more limited clean_html. PyPy JIT and html5lib is about 8x faster as it is cpython.
import html5lib
with from gumbo import html5lib
The tree generated from gumbo.html5lib.HTMLParser should be API-compatible with the one generated by html5lib.HTMLParser. (Possibly modulo some minor features...html5lib's maintainer has filed a bug about implementing treewalkers in the html5lib adaptor.)I'm not sure offhand what the speed would be - I'd imagine the Gumbo backend would be significantly faster than html5lib by virtue of being written in C, but speed was not a design goal, and so I suspect it's currently significantly slower than lxml. What Gumbo gives you over lxml is HTML5 compatibility - lxml does an HTML4-approximate parse.
Re: Google Open-Sources Gumbo: C Library for Parsing HTML5
#7I would be quite interested in Gumbo as the backend to the awesome pure Python but otherwise rather-slow https://github.com/html5lib/html5lib-python , which actually has great whitelisting/cleaning facilities but is easily an order of magnitude slower than lxml's more limited clean_html. PyPy JIT and html5lib is about 8x faster as it is cpython.
[1]: https://github.com/google/gumbo-parser/tree/master/python/gu...
Re: Google Open-Sources Gumbo: C Library for Parsing HTML5
#8The line:
Tested on over 2.5 billion pages from Google's index.
That's quite awesome, and would cover quite a few edge cases.Re: Google Open-Sources Gumbo: C Library for Parsing HTML5
#9How does this compare to Hubbub, another C library for parsing HTML5? http://www.netsurf-browser.org/projects/hubbub/
1. Hubbub provides a SAX-style (callback-based) API, while Gumbo gives you a DOM-style (tree-based) struct directly. Hubbub is likely faster in this regard, Gumbo is easier to use out-of-the-box.
2. Gumbo is better tested. It's unclear whether Hubbub's 90% test coverage is "90% of the code is tested" or "90% of the tests pass", but Gumbo has 100% code coverage, 100% of html5lib tests pass (as of 0.95; the html5lib maintainer has pointed out that additional tests were added to trunk recently that don't pass), and it's run without crashing on ~4.5B documents from Google's index.
3. Gumbo has better support for source locations and going between original text and parse tree.
4. Hubbub has character encoding detection, Gumbo doesn't.
Re: Google Open-Sources Gumbo: C Library for Parsing HTML5
#10A good thing about developing tools at Google is the access to test data with their index. The line: Tested on over 2.5 billion pages from Google's index. That's quite awesome, and would cover quite a few edge cases.
http://commoncrawl.org/a-look-inside-common-crawls-210tb-201...