Skip to content

Commit

Permalink
perf: use path.as_os_str().hash() instead of path.hash() (#316)
Browse files Browse the repository at this point in the history
perf: try `path.as_os_str().hash()` instead of `path.hash()`
  • Loading branch information
Boshen authored Nov 22, 2024
1 parent 6e45c48 commit 08a19d7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ impl<Fs: FileSystem> Cache<Fs> {
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) {
Expand Down

0 comments on commit 08a19d7

Please # to comment.