comparison 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
comparison
equal deleted inserted replaced
44544:8a237131ff0f 44545:07d9fd6097e6
208 let name = if !name.is_absolute() { 208 let name = if !name.is_absolute() {
209 root.join(&cwd).join(&name) 209 root.join(&cwd).join(&name)
210 } else { 210 } else {
211 name.to_owned() 211 name.to_owned()
212 }; 212 };
213 let mut auditor = PathAuditor::new(&root); 213 let auditor = PathAuditor::new(&root);
214 if name != root && name.starts_with(&root) { 214 if name != root && name.starts_with(&root) {
215 let name = name.strip_prefix(&root).unwrap(); 215 let name = name.strip_prefix(&root).unwrap();
216 auditor.audit_path(path_to_hg_path_buf(name)?)?; 216 auditor.audit_path(path_to_hg_path_buf(name)?)?;
217 return Ok(name.to_owned()); 217 return Ok(name.to_owned());
218 } else if name == root { 218 } else if name == root {