@@ -6,15 +6,42 @@ description:
6 upon the @attoparsec@ library. The parsing strategy is based upon the HTML5
6 upon the @attoparsec@ library. The parsing strategy is based upon the HTML5
7 parsing specification with few deviations.
7 parsing specification with few deviations.
11+ >>> parseTokens "<div><h1 class=widget>Hello World</h1><br/>"
13+ TagOpen "h1" [Attr "class" "widget"],
14+ ContentText "Hello World",
16+ TagSelfClose "br" []]
9 The package targets similar use-cases to the venerable @tagsoup@ library,
18 The package targets similar use-cases to the venerable @tagsoup@ library,
10 but is significantly more efficient, achieving parsing speeds of over 50
19 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:
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)
15− >>> parseTokens "<div><h1 class=widget>Hello World</h1><br/>"
32+ benchmarking Forced/tagsoup normal Text
16− [TagOpen "div" [],TagOpen "h1" [Attr "class" "widget"],
33+ time 176.9 ms (167.3 ms .. 188.5 ms)
17− ContentText "Hello World",TagClose "h1",TagSelfClose "br" []]
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)
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)
19homepage: http://github.com/bgamari/html-parse
46homepage: http://github.com/bgamari/html-parse
20license: BSD3
47license: BSD3