feat: Replace the elapsed dependency by std::time::Instant

This commit is contained in:
Clément Renault 2019-02-16 20:44:16 +01:00
parent bddb37e44f
commit 264fffa826
No known key found for this signature in database
GPG key ID: 0151CDAB43460DAE
6 changed files with 56 additions and 57 deletions

View file

@ -4,6 +4,7 @@ static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc;
use std::collections::{HashMap, HashSet};
use std::io::{self, BufRead, BufReader};
use std::path::{Path, PathBuf};
use std::time::Instant;
use std::error::Error;
use std::borrow::Cow;
use std::fs::File;
@ -124,14 +125,13 @@ fn main() -> Result<(), Box<Error>> {
None => HashSet::new(),
};
let (elapsed, result) = elapsed::measure_time(|| {
index(schema, &opt.database_path, &opt.csv_data_path, opt.update_group_size, &stop_words)
});
let start = Instant::now();
let result = index(schema, &opt.database_path, &opt.csv_data_path, opt.update_group_size, &stop_words);
if let Err(e) = result {
return Err(e.into())
}
println!("database created in {} at: {:?}", elapsed, opt.database_path);
println!("database created in {:.2?} at: {:?}", start.elapsed(), opt.database_path);
Ok(())
}