Skip to content

Commit

Permalink
mount allocprofiler in benches
Browse files Browse the repository at this point in the history
  • Loading branch information
aumetra committed May 11, 2024
1 parent 984af4e commit 5ad0bb2
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/http-signatures/benches/build_cavage_signature_string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ use divan::Bencher;
use http::{Method, Request, Uri};
use std::hint::black_box;

#[global_allocator]
static GLOBAL: divan::AllocProfiler = divan::AllocProfiler::system();

const CAVAGE_HEADER: &str =
r#"keyId="Test",algorithm="rsa-sha256",headers="(request-target) host date",signature="qdx""#;

Expand Down
3 changes: 3 additions & 0 deletions lib/http-signatures/benches/parse_cavage_header.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
use divan::{black_box, black_box_drop};
use http_signatures::cavage;

#[global_allocator]
static GLOBAL: divan::AllocProfiler = divan::AllocProfiler::system();

const CAVAGE_HEADER_1: &str = r#"keyId="Test",algorithm="rsa-sha256",headers="(request-target) host date",signature="qdx+H7PHHDZgy4y/Ahn9Tny9V3GP6YgBPyUXMmoxWtLbHpUnXS2mg2+SbrQDMCJypxBLSPQR2aAjn7ndmw2iicw3HMbe8VfEdKFYRqzic+efkb3nndiv/x1xSHDJWeSWkx3ButlYSuBskLu6kd9Fswtemr3lgdDEmn04swr2Os0=""#;
const CAVAGE_HEADER_2: &str = r#"keyId="Test",algorithm="rsa-sha256",created=1402170695, expires=1402170699,headers="(request-target) (created) (expires) host date content-type digest content-length",signature="vSdrb+dS3EceC9bcwHSo4MlyKS59iFIrhgYkz8+oVLEEzmYZZvRs8rgOp+63LEM3v+MFHB32NfpB2bEKBIvB1q52LaEUHFv120V01IL+TAD48XaERZFukWgHoBTLMhYS2Gb51gWxpeIq8knRmPnYePbF5MOkR0Zkly4zKH7s1dE=""#;

Expand Down
3 changes: 3 additions & 0 deletions lib/masto-id-convert/benches/process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

use divan::{black_box, black_box_drop};

#[global_allocator]
static GLOBAL: divan::AllocProfiler = divan::AllocProfiler::system();

#[divan::bench(name = "process integer 110368129515784116")]
fn process_u64() {
black_box_drop(masto_id_convert::process_u64(black_box(110368129515784116)));
Expand Down
3 changes: 3 additions & 0 deletions lib/post-process/benches/simple.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ use divan::black_box;
use futures_executor::block_on;
use std::future;

#[global_allocator]
static GLOBAL: divan::AllocProfiler = divan::AllocProfiler::system();

const SIMPLE_POST: &str = "Hello, #World! This is a benchmark for the post transformer of @kitsune";

#[divan::bench]
Expand Down
3 changes: 3 additions & 0 deletions lib/tick-tock-mock/benches/simple_now.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ use divan::{black_box, Bencher};
use std::time::{Duration, SystemTime};
use tick_tock_mock::{Clock, DeltaDirection};

#[global_allocator]
static GLOBAL: divan::AllocProfiler = divan::AllocProfiler::system();

#[divan::bench]
fn std_systemtime_now() -> SystemTime {
black_box(SystemTime::now())
Expand Down

0 comments on commit 5ad0bb2

Please sign in to comment.