File: date-formatting.rs

package info (click to toggle)
rust-actix-http 3.9.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,168 kB
  • sloc: makefile: 2
file content (20 lines) | stat: -rw-r--r-- 401 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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();
}