Skip to content

Commit

Permalink
test: black box bench inputs (#81)
Browse files Browse the repository at this point in the history
  • Loading branch information
robjtede authored Feb 24, 2025
1 parent 341d47c commit 6aa04b1
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions benches/display.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,32 +12,38 @@ impl fmt::Display for ByteSizeAlwaysPad {

#[divan::bench]
fn display_inner_display() {
black_box(format!("{}", bytesize::ByteSize::kib(42).display()));
black_box(format!(
"{}",
black_box(bytesize::ByteSize::kib(42).display()),
));
}

#[divan::bench]
fn display_bytesize_standard() {
black_box(format!("{}", bytesize::ByteSize::kib(42).display()));
black_box(format!(
"{}",
black_box(bytesize::ByteSize::kib(42).display()),
));
}

#[divan::bench]
fn display_bytesize_custom() {
black_box(format!("|{:-^10}|", bytesize::ByteSize::kib(42)));
black_box(format!("|{:-^10}|", black_box(bytesize::ByteSize::kib(42))));
}

#[divan::bench]
fn display_always_pad_standard() {
black_box(format!(
"{}",
ByteSizeAlwaysPad(bytesize::ByteSize::kib(42))
black_box(ByteSizeAlwaysPad(bytesize::ByteSize::kib(42))),
));
}

#[divan::bench]
fn display_always_pad_custom() {
black_box(format!(
"|{:-^10}|",
ByteSizeAlwaysPad(bytesize::ByteSize::kib(42))
black_box(ByteSizeAlwaysPad(bytesize::ByteSize::kib(42))),
));
}

Expand Down

0 comments on commit 6aa04b1

Please sign in to comment.