Merge pull request #87 from Kerollmops/measure-index-loading

Display index loading times
This commit is contained in:
Clément Renault 2019-01-24 14:07:11 +01:00 committed by GitHub
commit fbc698567a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 3 deletions

View File

@ -39,10 +39,18 @@ where D: Deref<Target=DB>
fn retrieve_data_index<D>(snapshot: &Snapshot<D>) -> Result<Index, Box<Error>>
where D: Deref<Target=DB>
{
let index = match snapshot.get(DATA_INDEX)? {
let (elapsed, vector) = elapsed::measure_time(|| snapshot.get(DATA_INDEX));
info!("loading index from kv-store took {}", elapsed);
let index = match vector? {
Some(vector) => {
let bytes = vector.as_ref().to_vec();
Index::from_bytes(bytes)?
info!("index size if {} MiB", bytes.len() / 1024 / 1024);
let (elapsed, index) = elapsed::measure_time(|| Index::from_bytes(bytes));
info!("loading index from bytes took {}", elapsed);
index?
},
None => Index::default(),
};

View File

@ -162,7 +162,6 @@ where D: Deref<Target=DB>,
let (elapsed, ()) = elapsed::measure_time(|| {
group.sort_unstable_by(|a, b| criterion.evaluate(a, b, view));
});
info!("criterion {} sort took {}", ci, elapsed);
for group in BinaryGroupByMut::new(group, |a, b| criterion.eq(a, b, view)) {