1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-26 09:10:40 -05:00
denoland-deno/ext/http/benches/compressible.rs
David Sherret 2fee8394a9
chore: update copyright year to 2023 (#17247)
Yearly tradition of creating extra noise in git.
2023-01-05 13:05:49 +01:00

37 lines
833 B
Rust

// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
use bencher::{benchmark_group, benchmark_main, Bencher};
use deno_http::compressible::is_content_compressible;
fn compressible_simple_hit(b: &mut Bencher) {
b.iter(|| {
is_content_compressible("text/plain");
})
}
fn compressible_complex_hit(b: &mut Bencher) {
b.iter(|| {
is_content_compressible("text/PlAIn; charset=utf-8");
})
}
fn compressible_simple_miss(b: &mut Bencher) {
b.iter(|| {
is_content_compressible("text/fake");
})
}
fn compressible_complex_miss(b: &mut Bencher) {
b.iter(|| {
is_content_compressible("text/fake;charset=utf-8");
})
}
benchmark_group!(
benches,
compressible_simple_hit,
compressible_complex_hit,
compressible_simple_miss,
compressible_complex_miss,
);
benchmark_main!(benches);