Mercurial > public > mercurial-scm > hg
diff rust/hg-core/src/revlog/filelog.rs @ 49517:52464a20add0
rhg: parallellize computation of [unsure_is_modified]
[unsure_is_modified] is called for every file for which we can't
determine its status based on its size and mtime alone.
In particular, this happens if the mtime of the file changes
without its contents changing.
Parallellizing this improves performance significantly when
we have many of these files.
Here's an example run (on a repo with ~400k files after dropping FS caches)
```
before:
real 0m53.901s
user 0m27.806s
sys 0m31.325s
after:
real 0m32.017s
user 0m34.277s
sys 1m26.250s
```
Another example run (a different FS):
```
before:
real 3m28.479s
user 0m31.800s
sys 0m25.324s
after:
real 0m29.751s
user 0m41.814s
sys 1m15.387s
```
author | Arseniy Alekseyev <aalekseyev@janestreet.com> |
---|---|
date | Wed, 05 Oct 2022 15:45:05 -0400 |
parents | 3f86ee422095 |
children | e98fd81bb151 |
line wrap: on
line diff
--- a/rust/hg-core/src/revlog/filelog.rs Wed Sep 21 10:14:29 2022 -0400 +++ b/rust/hg-core/src/revlog/filelog.rs Wed Oct 05 15:45:05 2022 -0400 @@ -17,18 +17,21 @@ } impl Filelog { - pub fn open(repo: &Repo, file_path: &HgPath) -> Result<Self, HgError> { + pub fn open_vfs( + store_vfs: &crate::vfs::Vfs<'_>, + file_path: &HgPath, + ) -> Result<Self, HgError> { let index_path = store_path(file_path, b".i"); let data_path = store_path(file_path, b".d"); - let revlog = Revlog::open( - &repo.store_vfs(), - index_path, - Some(&data_path), - false, - )?; + let revlog = + Revlog::open(store_vfs, index_path, Some(&data_path), false)?; Ok(Self { revlog }) } + pub fn open(repo: &Repo, file_path: &HgPath) -> Result<Self, HgError> { + Self::open_vfs(&repo.store_vfs(), file_path) + } + /// The given node ID is that of the file as found in a filelog, not of a /// changeset. pub fn data_for_node(