From 08a19d77f0068e34fb270bc993576aca465a23e0 Mon Sep 17 00:00:00 2001 From: Boshen Date: Fri, 22 Nov 2024 13:58:44 +0800 Subject: [PATCH] perf: use `path.as_os_str().hash()` instead of `path.hash()` (#316) perf: try `path.as_os_str().hash()` instead of `path.hash()` --- src/cache.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cache.rs b/src/cache.rs index e0cf1cc0..5ea0a1ae 100644 --- a/src/cache.rs +++ b/src/cache.rs @@ -44,7 +44,7 @@ impl Cache { pub fn value(&self, path: &Path) -> CachedPath { let hash = { let mut hasher = FxHasher::default(); - path.hash(&mut hasher); + path.as_os_str().hash(&mut hasher); hasher.finish() }; if let Some(cache_entry) = self.paths.get((hash, path).borrow() as &dyn CacheKey) {