feat(crc): add iai bench
This commit is contained in:
parent
c77927711d
commit
83ff767c5f
3 changed files with 20 additions and 0 deletions
7
Cargo.lock
generated
7
Cargo.lock
generated
|
@ -140,6 +140,7 @@ name = "crc"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"criterion",
|
"criterion",
|
||||||
|
"iai",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -321,6 +322,12 @@ dependencies = [
|
||||||
"libc",
|
"libc",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "iai"
|
||||||
|
version = "0.1.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "71a816c97c42258aa5834d07590b718b4c9a598944cd39a52dc25b351185d678"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "itertools"
|
name = "itertools"
|
||||||
version = "0.10.5"
|
version = "0.10.5"
|
||||||
|
|
|
@ -7,7 +7,12 @@ edition = "2024"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
criterion = "0.3"
|
criterion = "0.3"
|
||||||
|
iai = "0.1.1"
|
||||||
|
|
||||||
[[bench]]
|
[[bench]]
|
||||||
name = "crc32bench"
|
name = "crc32bench"
|
||||||
harness = false
|
harness = false
|
||||||
|
|
||||||
|
[[bench]]
|
||||||
|
name = "crc32bench_iai"
|
||||||
|
harness = false
|
||||||
|
|
8
crates/crc/benches/crc32bench_iai.rs
Executable file
8
crates/crc/benches/crc32bench_iai.rs
Executable file
|
@ -0,0 +1,8 @@
|
||||||
|
use crc::{Crc, Crc32};
|
||||||
|
use iai::black_box;
|
||||||
|
|
||||||
|
fn iai_benchmark_short() -> <Crc32 as Crc>::Checksum {
|
||||||
|
Crc32::checksum(black_box(&crc::CHECK_DATA))
|
||||||
|
}
|
||||||
|
|
||||||
|
iai::main!(iai_benchmark_short);
|
Loading…
Add table
Reference in a new issue