@@ -6,15 +6,42 @@ description:
66 upon the @attoparsec@ library. The parsing strategy is based upon the HTML5
77 parsing specification with few deviations.
88 .
9+ For instance,
10+ .
11+ >>> parseTokens "<div><h1 class=widget>Hello World</h1><br/>"
12+ [TagOpen "div" [],
13+ TagOpen "h1" [Attr "class" "widget"],
14+ ContentText "Hello World",
15+ TagClose "h1",
16+ TagSelfClose "br" []]
17+ .
918 The package targets similar use-cases to the venerable @tagsoup@ library,
1019 but is significantly more efficient, achieving parsing speeds of over 50
11− megabytes per second on modern hardware with and typical web documents.
20+ megabytes per second on modern hardware and typical web documents.
21+ Here are some typical performance numbers taken from parsing a Wikipedia
22+ article of moderate length:
1223 .
13− For instance,
24+ @
25+ benchmarking Forced/tagsoup fast Text
26+ time 171.2 ms (166.4 ms .. 177.3 ms)
27+ 0.999 R² (0.997 R² .. 1.000 R²)
28+ mean 171.9 ms (169.4 ms .. 173.2 ms)
29+ std dev 2.516 ms (1.104 ms .. 3.558 ms)
30+ variance introduced by outliers: 12% (moderately inflated)
1431 .
15− >>> parseTokens "<div><h1 class=widget>Hello World</h1><br/>"
16− [TagOpen "div" [],TagOpen "h1" [Attr "class" "widget"],
17− ContentText "Hello World",TagClose "h1",TagSelfClose "br" []]
32+ benchmarking Forced/tagsoup normal Text
33+ time 176.9 ms (167.3 ms .. 188.5 ms)
34+ 0.998 R² (0.994 R² .. 1.000 R²)
35+ mean 180.7 ms (177.5 ms .. 183.7 ms)
36+ std dev 4.246 ms (2.316 ms .. 5.803 ms)
37+ variance introduced by outliers: 14% (moderately inflated)
38+ .
39+ benchmarking Forced/html-parser
40+ time 20.88 ms (20.60 ms .. 21.25 ms)
41+ 0.999 R² (0.998 R² .. 0.999 R²)
42+ mean 20.99 ms (20.81 ms .. 21.20 ms)
43+ std dev 446.1 μs (336.4 μs .. 596.2 μs)
44+ @
1845
1946homepage: http://github.com/bgamari/html-parse
2047license: BSD3