Commit 425642f5 authored by Arseniy Alekseyev's avatar Arseniy Alekseyev
Browse files

rhg: do not try to open a nodemap for an inline index

This saves an [open] system call per file, which is a small saving, but
it showed up in the profile at large file counts (it accounted for 30ms
out of 400ms needed for catting 10000 files, on a ZFS filesystem on Linux,
so ~3us per syscall).

Differential Revision: https://phab.mercurial-scm.org/D11659
parent 0cc69017d47f
......@@ -57,7 +57,7 @@ impl Index {
/// Value of the inline flag.
pub fn is_inline(&self) -> bool {
is_inline(&self.bytes)
self.offsets.is_some()
}
/// Return a slice of bytes if `revlog` is inline. Panic if not.
......
......@@ -99,14 +99,18 @@ impl Revlog {
Some(Box::new(data_mmap))
};
let nodemap = NodeMapDocket::read_from_file(repo, index_path)?.map(
|(docket, data)| {
nodemap::NodeTree::load_bytes(
Box::new(data),
docket.data_length,
)
},
);
let nodemap = if index.is_inline() {
None
} else {
NodeMapDocket::read_from_file(repo, index_path)?.map(
|(docket, data)| {
nodemap::NodeTree::load_bytes(
Box::new(data),
docket.data_length,
)
},
)
};
Ok(Revlog {
index,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment