git.iko.soy/typeable/attoparsec
on master help sign in
Correct the http benchmarks. There two two unrelated issues

with them. The first was that the samples had extra newline breaks in them which would cause the request and the response to be parsed incorrectly. The second was that the warp request parser was used incorrectly. It needs to be fed a list of bytestring that has already been split on newlines. The results of the changes are that the request parsers for both warp and attoparsec are significantly slower. The warp one is about 15x slower than it previously was because it previously did almost no work. It is not totally clear why the attoparsec one is slower, but it is 3x slower than it previously was.

commitfede5d1793e0ab586510edd24a3b6ff615e5177d authorAndrew Martin <andrew.thaddeus@gmail.com> dateMon 19 Mar 2018, 17:04 (9 years ago) parent213dc8f
3 files changed+6−13
benchmarks/HeadersByteString.hs+1−1 benchmarks/http-request.txt+3−8 benchmarks/http-response.txt+2−4
benchmarks/HeadersByteString.hs+1−1
@@ -18,7 +18,7 @@ headers = do
1818 return $ bgroup "headers" [
1919 bgroup "B" [
2020 bench "request" $ nf (B.parseOnly request) req
21− , bench "warp" $ nfIO (parseHeaderLines [req])
21+ , bench "warp" $ nfIO (parseHeaderLines (B.split '\n' req))
2222 , bench "response" $ nf (B.parseOnly response) resp
2323 ]
2424 , bgroup "BL" [
benchmarks/http-request.txt+3−8
@@ -1,14 +1,9 @@
11GET / HTTP/1.1
22Host: twitter.com
3−Accept: text/html, application/xhtml+xml, application/xml; q=0.9,
4− image/webp, */*; q=0.8
3+Accept: text/html, application/xhtml+xml, application/xml; q=0.9, image/webp, */*; q=0.8
54Accept-Encoding: gzip,deflate,sdch
65Accept-Language: en-GB,en-US;q=0.8,en;q=0.6
76Cache-Control: max-age=0
8−Cookie: guest_id=v1%3A139; _twitter_sess=BAh7CSIKZmxhc2hJQz-e1e1;
9− __utma=43838368.452555194.1399611824.1; __utmb=43838368;
10− __utmc=43838368; __utmz=1399611824.1.1.utmcsr=(direct)|utmcmd=(none)
11−User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_5)
12− AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.86
13− Safari/537.36
7+Cookie: guest_id=v1%3A139; _twitter_sess=BAh7CSIKZmxhc2hJQz-e1e1; __utma=43838368.452555194.1399611824.1; __utmb=43838368; __utmc=43838368; __utmz=1399611824.1.1.utmcsr=(direct)|utmcmd=(none)
8+User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.86 Safari/537.36
149
benchmarks/http-response.txt+2−4
@@ -3,10 +3,8 @@ Date: Fri, 09 May 2014 04:24:57 GMT
33Expires: -1
44Cache-Control: private, max-age=0
55Content-Type: text/html; charset=ISO-8859-1
6−Set-Cookie: PREF=ID=1a871afc4240db5e:FF:LM=1399609497:S=e5MZ0itEekjVwNcU;
7− expires=Sun, 08-May-2016 04:24:57 GMT; path=/; domain=.google.com
8−Set-Cookie: NID=67=-WlfaDG6VSEPk7abAjrK98HBSoCD2ID6JKkUR95tEumzDmg7Fc8pSQ8;
9− expires=Sat, 08-Nov-2014 04:24:57 GMT; path=/; domain=.google.com; HttpOnly
6+Set-Cookie: PREF=ID=1a871afc4240db5e:FF:LM=1399609497:S=e5MZ0itEekjVwNcU; expires=Sun, 08-May-2016 04:24:57 GMT; path=/; domain=.google.com
7+Set-Cookie: NID=67=-WlfaDG6VSEPk7abAjrK98HBSoCD2ID6JKkUR95tEumzDmg7Fc8pSQ8; expires=Sat, 08-Nov-2014 04:24:57 GMT; path=/; domain=.google.com; HttpOnly
108P3P: CP="This is not a P3P policy! See http://www.google.com/support/accounts/bin/answer.py?hl=en&answer=151657 for more info."
119Server: gws
1210X-XSS-Protection: 1; mode=block