mirror of
https://github.com/fafhrd91/actix-web
synced 2024-11-30 10:42:55 +01:00
21 lines
401 B
Rust
21 lines
401 B
Rust
use std::time::SystemTime;
|
|
|
|
use actix_http::header::HttpDate;
|
|
use divan::{black_box, AllocProfiler, Bencher};
|
|
|
|
#[global_allocator]
|
|
static ALLOC: AllocProfiler = AllocProfiler::system();
|
|
|
|
#[divan::bench]
|
|
fn date_formatting(b: Bencher<'_, '_>) {
|
|
let now = SystemTime::now();
|
|
|
|
b.bench(|| {
|
|
black_box(HttpDate::from(black_box(now)).to_string());
|
|
})
|
|
}
|
|
|
|
fn main() {
|
|
divan::main();
|
|
}
|