Vendor things
This commit is contained in:
parent
5deceec006
commit
977e3c17e5
19434 changed files with 10682014 additions and 0 deletions
36
third-party/vendor/winnow/examples/http/bench.rs
vendored
Normal file
36
third-party/vendor/winnow/examples/http/bench.rs
vendored
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
mod parser;
|
||||
mod parser_streaming;
|
||||
|
||||
fn one_test(c: &mut criterion::Criterion) {
|
||||
let data = &b"GET / HTTP/1.1
|
||||
Host: www.reddit.com
|
||||
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:15.0) Gecko/20100101 Firefox/15.0.1
|
||||
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
|
||||
Accept-Language: en-us,en;q=0.5
|
||||
Accept-Encoding: gzip, deflate
|
||||
Connection: keep-alive
|
||||
|
||||
"[..];
|
||||
|
||||
let mut http_group = c.benchmark_group("http");
|
||||
http_group.throughput(criterion::Throughput::Bytes(data.len() as u64));
|
||||
http_group.bench_with_input(
|
||||
criterion::BenchmarkId::new("complete", data.len()),
|
||||
data,
|
||||
|b, data| {
|
||||
b.iter(|| parser::parse(data).unwrap());
|
||||
},
|
||||
);
|
||||
http_group.bench_with_input(
|
||||
criterion::BenchmarkId::new("streaming", data.len()),
|
||||
data,
|
||||
|b, data| {
|
||||
b.iter(|| parser_streaming::parse(data).unwrap());
|
||||
},
|
||||
);
|
||||
|
||||
http_group.finish();
|
||||
}
|
||||
|
||||
criterion::criterion_group!(http, one_test);
|
||||
criterion::criterion_main!(http);
|
||||
Loading…
Add table
Add a link
Reference in a new issue