Mercurial > public > mercurial-scm > hg-stable
diff rust/hg-core/src/utils/files.rs @ 44545:07d9fd6097e6
rust-pathauditor: use interior mutability for use in multi-threaded contexts
The usual recommendation for using `RwLock` or `Mutex` is that if there are
about as many write as there are reads, use `Mutex`, and if there are more
reads than writes, use `RwLock`.
If after the main bottleneck (i.e. parallel traversal) is removed this shows
up on profiles, we should investigate using the `parking_lot` since we don't
need a poisoning API, or maybe move to different types of caches entirely.
Differential Revision: https://phab.mercurial-scm.org/D8213
author | Rapha?l Gom?s <rgomes@octobus.net> |
---|---|
date | Wed, 04 Mar 2020 15:10:11 +0100 |
parents | 4caac36c66bc |
children | 26114bd6ec60 |
line wrap: on
line diff
--- a/rust/hg-core/src/utils/files.rs Wed Mar 04 15:12:08 2020 +0100 +++ b/rust/hg-core/src/utils/files.rs Wed Mar 04 15:10:11 2020 +0100 @@ -210,7 +210,7 @@ } else { name.to_owned() }; - let mut auditor = PathAuditor::new(&root); + let auditor = PathAuditor::new(&root); if name != root && name.starts_with(&root) { let name = name.strip_prefix(&root).unwrap(); auditor.audit_path(path_to_hg_path_buf(name)?)?;