diff options
author | Nicolas Pitre <nico@fluxnic.net> | 2013-09-13 20:56:31 -0400 |
---|---|---|
committer | Nicolas Pitre <nico@fluxnic.net> | 2013-09-18 00:22:05 -0400 |
commit | aaba410898d4d286835995f7e50f38298445f3d5 (patch) | |
tree | 72a2716720d8efd26ff9e860723635d4c79563a8 /sha1_file.c | |
parent | cc032c50f49c20929bc07cf4308455c28facb928 (diff) | |
download | git-np/pack-v4.tar.gz |
packv4-parse.c: add tree offset cachingnp/pack-v4
It is a common pattern to see a tree object copy a few entries from another
tree object, possibly from a non zero offset, then provide a few entries
of its own just to go back to the previous tree object to copy some more
entries. Each time this happens, the tree object being copied has to be
parsed from the beginning over again up to the desired offset which is
rather wasteful.
Let's introduce a tree offset cache to record the entry position and offset
when tree parsing stops so a subsequent copy from the same tree object
can be resumed without having to start from the beginning all the time.
Without doing further tuning on this cache, performing "git rev-list --all
--objects | wc -l" on my copy of git.git went from 14.5s down to 6.6s.
Signed-off-by: Nicolas Pitre <nico@fluxnic.net>
Diffstat (limited to 'sha1_file.c')
-rw-r--r-- | sha1_file.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/sha1_file.c b/sha1_file.c index 038e22e559..e98eb8be05 100644 --- a/sha1_file.c +++ b/sha1_file.c @@ -2178,7 +2178,7 @@ void *unpack_entry(struct packed_git *p, off_t obj_offset, type -= 8; break; case OBJ_PV4_TREE: - data = pv4_get_tree(p, &w_curs, curpos, size); + data = pv4_get_tree(p, &w_curs, obj_offset, size); type -= 8; break; case OBJ_COMMIT: |