mirror of https://github.com/zkat/cacache-rs.git
22 lines
528 B
Rust
22 lines
528 B
Rust
use criterion::{
|
|
black_box,
|
|
Criterion,
|
|
criterion_group,
|
|
criterion_main
|
|
};
|
|
use cacache;
|
|
use tempfile;
|
|
|
|
fn get(c: &mut Criterion) {
|
|
let tmp = tempfile::tempdir().unwrap();
|
|
let cache = tmp.path().to_owned();
|
|
let data = b"hello world".to_vec();
|
|
let sri = cacache::put::data(&cache, "hello", data).unwrap();
|
|
c.bench_function("read_hash", move |b| {
|
|
b.iter(|| cacache::get::read_hash(black_box(&cache), black_box(&sri)))
|
|
});
|
|
}
|
|
|
|
criterion_group!(benches, get);
|
|
criterion_main!(benches);
|