Browse Source
ObjectDirectoryInserter was always creating a temporary file, writing the complete compressed contents of a tree, fsync()'ing that to stable storage, and only then checking to see if there was already an object with the same SHA-1 in the repository. For commits this strategy makes some sense, the commit is very unlikely to exist in the repository, as there are embedded times and these change with each commit. However for trees coming out of DirCache, it is more common for the tree to already exist in the repository. Most subdirectories are not modified in any given commit. Doing all of this local file IO for things that already exist is very slow. Try to detect cases where the object is "small enough" that it can be processed entirely in memory, and avoid doing disk IO entirely if the object already exists. Also increase the size of the output buffer for the deflation. This should boost the average write(2) syscall size from 512 bytes to 8192 bytes, making streaming of large compressed contents to disk slightly more efficient. Change-Id: I1d40364e8725468522435814631916d73174c92b Signed-off-by: Shawn O. Pearce <spearce@spearce.org>stable-1.2
Shawn O. Pearce
14 years ago
1 changed files with 56 additions and 4 deletions
Loading…
Reference in new issue