mirror of
https://github.com/denoland/deno.git
synced 2024-12-14 19:37:59 -05:00
d5634164cb
Closes https://github.com/denoland/deno/issues/2699 Closes https://github.com/denoland/deno/issues/2347 Uses unstable rustfmt features. Since dprint invokes `rustfmt` we do not need to switch the cargo toolchain to nightly. Do we care about formatting stability of our codebase across Rust versions? (I don't)
39 lines
857 B
Rust
39 lines
857 B
Rust
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
|
use bencher::benchmark_group;
|
|
use bencher::benchmark_main;
|
|
use bencher::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);
|