mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-04-26 08:57:26 +02:00
19 lines
530 B
Rust
19 lines
530 B
Rust
use criterion::{criterion_group, criterion_main, Criterion};
|
|
use iblt::IBLT;
|
|
|
|
const CAPACITY: usize = 4096;
|
|
type OurIBLT = IBLT<[u8; 32], CAPACITY, 3>;
|
|
|
|
pub fn criterion_benchmark(c: &mut Criterion) {
|
|
let mut iblt = OurIBLT::new();
|
|
for _ in 0..CAPACITY {
|
|
let mut v = [0u8; 32];
|
|
v.fill_with(rand::random);
|
|
iblt.insert(&v);
|
|
}
|
|
|
|
c.bench_function("to_from_bytes", |b| b.iter(|| OurIBLT::from_bytes(iblt.as_bytes())));
|
|
}
|
|
|
|
criterion_group!(benches, criterion_benchmark);
|
|
criterion_main!(benches);
|