Name Description Size Coverage
parse.rs ;q=0.8\r\n\ Accept-Language: ja,en-us;q=0.7,en;q=0.3\r\n\ Accept-Encoding: gzip,deflate\r\n\ Accept-Charset: Shift_JIS,utf-8;q=0.7,*;q=0.7\r\n\ Keep-Alive: 115\r\n\ Connection: keep-alive\r\n\ Cookie: wp_ozh_wsa_visits=2; wp_ozh_wsa_visit_lasttime=xxxxxxxxxx; __utma=xxxxxxxxx.xxxxxxxxxx.xxxxxxxxxx.xxxxxxxxxx.xxxxxxxxxx.x; __utmz=xxxxxxxxx.xxxxxxxxxx.x.x.utmccn=(referral)|utmcsr=reader.livedoor.com|utmcct=/reader/|utmcmd=referral|padding=under256\r\n\r\n"; fn req(c: &mut Criterion) { c.benchmark_group("req") .throughput(Throughput::Bytes(REQ.len() as u64)) .bench_function("req", |b| b.iter_batched_ref(|| { [httparse::Header { name: "", value: &[], }; 16] },|headers| { let mut req = httparse::Request::new(headers); assert_eq!( black_box(req.parse(REQ).unwrap()), httparse::Status::Complete(REQ.len()) ); }, BatchSize::SmallInput)); } fn req_short(c: &mut Criterion) { c.benchmark_group("req_short") .throughput(Throughput::Bytes(REQ_SHORT.len() as u64)) .bench_function("req_short", |b| b.iter_batched_ref(|| { [httparse::Header { name: "", value: &[], }; 16] },|headers| { let mut req = httparse::Request::new(headers); assert_eq!( req.parse(black_box(REQ_SHORT)).unwrap(), httparse::Status::Complete(REQ_SHORT.len()) ); }, BatchSize::SmallInput)); } const RESP_SHORT: &[u8] = b"\ HTTP/1.0 200 OK\r\n\ Date: Wed, 21 Oct 2015 07:28:00 GMT\r\n\ Set-Cookie: session=60; user_id=1\r\n\r\n"; // These particular headers don't all make semantic sense for a response, but they're syntactically valid. const RESP: &[u8] = b"\ HTTP/1.1 200 OK\r\n\ Date: Wed, 21 Oct 2015 07:28:00 GMT\r\n\ Host: www.kittyhell.com\r\n\ User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; ja-JP-mac; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3 Pathtraq/0.9\r\n\ Accept: text/html,application/xhtml+xml,application/xml;q=0.9, 9177 -