mirror of https://github.com/zkat/cacache-rs.git
added benchmarks for write
This commit is contained in:
parent
addf858ab7
commit
d748889d9f
|
|
@ -174,19 +174,39 @@ fn read_hash_async_big_data(c: &mut Criterion) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn write_hash_async(c: &mut Criterion) {
|
||||||
|
let tmp = tempfile::tempdir().unwrap();
|
||||||
|
let cache = tmp.path().to_owned();
|
||||||
|
c.bench_function("put::data", move |b| {
|
||||||
|
b.iter_custom(|iters| {
|
||||||
|
let start = std::time::Instant::now();
|
||||||
|
for i in 0..iters {
|
||||||
|
task::block_on(cacache::write(
|
||||||
|
&cache,
|
||||||
|
format!("hello{}", i),
|
||||||
|
format!("hello world{}", i),
|
||||||
|
))
|
||||||
|
.unwrap();
|
||||||
|
}
|
||||||
|
start.elapsed()
|
||||||
|
})
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
criterion_group!(
|
criterion_group!(
|
||||||
benches,
|
benches,
|
||||||
baseline_read_sync,
|
// baseline_read_sync,
|
||||||
baseline_read_many_sync,
|
// baseline_read_many_sync,
|
||||||
baseline_read_async,
|
// baseline_read_async,
|
||||||
baseline_read_many_async,
|
// baseline_read_many_async,
|
||||||
read_hash_async,
|
// read_hash_async,
|
||||||
read_hash_many_async,
|
// read_hash_many_async,
|
||||||
read_hash_sync,
|
// read_async,
|
||||||
read_hash_many_sync,
|
write_hash_async,
|
||||||
read_async,
|
// read_hash_sync,
|
||||||
read_sync,
|
// read_hash_many_sync,
|
||||||
read_hash_async_big_data,
|
// read_sync,
|
||||||
read_hash_sync_big_data
|
// read_hash_async_big_data,
|
||||||
|
// read_hash_sync_big_data
|
||||||
);
|
);
|
||||||
criterion_main!(benches);
|
criterion_main!(benches);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue