diff options
author | Canop <cano.petrole@gmail.com> | 2021-02-22 13:35:56 +0100 |
---|---|---|
committer | Canop <cano.petrole@gmail.com> | 2021-02-22 13:35:56 +0100 |
commit | 4e035c40bd41a2f15adf1dae9953578440ef5084 (patch) | |
tree | 5473a67b69cf556b748774b17a59c04a427660f8 /src/file_sum | |
parent | da67eb50e36fd55be27a1e6865c38b2eb03ff1b1 (diff) |
use ahash of some of the hashmaps with big keys
Diffstat (limited to 'src/file_sum')
-rw-r--r-- | src/file_sum/mod.rs | 7 | ||||
-rw-r--r-- | src/file_sum/sum_computation.rs | 4 |
2 files changed, 5 insertions, 6 deletions
diff --git a/src/file_sum/mod.rs b/src/file_sum/mod.rs index d966a8d..db7714c 100644 --- a/src/file_sum/mod.rs +++ b/src/file_sum/mod.rs @@ -9,7 +9,7 @@ use { app::*, task_sync::Dam, }, - fnv::FnvHashMap, + ahash::AHashMap, std::{ ops::AddAssign, path::{Path, PathBuf}, @@ -18,8 +18,8 @@ use { }; lazy_static! { - static ref SUM_CACHE_MUTEX: Mutex<FnvHashMap<PathBuf, FileSum>> = - Mutex::new(FnvHashMap::default()); + static ref SUM_CACHE_MUTEX: Mutex<AHashMap<PathBuf, FileSum>> = + Mutex::new(AHashMap::default()); } pub fn clear_cache() { @@ -69,7 +69,6 @@ impl FileSum { Some(sum) => Some(*sum), None => { let sum = time!( - Debug, "sum computation", path, sum_computation::compute_dir_sum(path, &mut sum_cache, dam, con), diff --git a/src/file_sum/sum_computation.rs b/src/file_sum/sum_computation.rs index c623fff..89f2a25 100644 --- a/src/file_sum/sum_computation.rs +++ b/src/file_sum/sum_computation.rs @@ -6,7 +6,7 @@ use { task_sync::Dam, }, crossbeam::channel, - fnv::FnvHashMap, + ahash::AHashMap, rayon::{ThreadPool, ThreadPoolBuilder}, std::{ convert::TryInto, @@ -56,7 +56,7 @@ fn is_ignored(path: &Path, special_paths: &[SpecialPath]) -> bool { /// see https://doc.rust-lang.org/std/os/unix/fs/trait.MetadataExt.html#tymethod.blocks pub fn compute_dir_sum( path: &Path, - cache: &mut FnvHashMap<PathBuf, FileSum>, + cache: &mut AHashMap<PathBuf, FileSum>, dam: &Dam, con: &AppContext, ) -> Option<FileSum> { |