mirror of
https://github.com/static-web-server/static-web-server.git
synced 2026-01-25 05:06:33 +00:00
* fix: update dependencies 23-10-2025 * chore: update dependencies 26-10-2025 * chore: update dependencies 26.10.2025 & bump up MSRV to 1.85.0 * fix: lint errors * fix: style edition 2024 SWS now requires Rust 1.85.0 (Rust 2024 Edition) or later https://blog.rust-lang.org/2025/02/20/Rust-1.85.0/
20 lines
630 B
Rust
20 lines
630 B
Rust
use criterion::{BenchmarkId, Criterion, criterion_group, criterion_main};
|
|
|
|
use hyper::{Body, Response, StatusCode};
|
|
use static_web_server::control_headers;
|
|
|
|
fn append_headers_benchmark(c: &mut Criterion) {
|
|
let mut resp = Response::new(Body::empty());
|
|
*resp.status_mut() = StatusCode::OK;
|
|
let uri_path: &str = "assets/image.jpg";
|
|
|
|
c.bench_with_input(
|
|
BenchmarkId::new("uri_path_input", uri_path),
|
|
&uri_path,
|
|
|b, &s| b.iter(|| control_headers::append_headers(s, &mut resp)),
|
|
);
|
|
}
|
|
|
|
criterion_group!(control_headers_bench, append_headers_benchmark);
|
|
criterion_main!(control_headers_bench);
|