summaryrefslogtreecommitdiff
path: root/resolve-undo.h
diff options
context:
space:
mode:
authorLibravatar Thomas Rast <trast@student.ethz.ch>2013-03-28 09:19:34 +0100
committerLibravatar Junio C Hamano <gitster@pobox.com>2013-03-28 07:45:21 -0700
commitd1b9b76734d2ec31d41ba6e7beddab7c880dff85 (patch)
treef26642620873a20bec10dbf72677a3707fe2cb4d /resolve-undo.h
parentMore fixes for 1.8.2.1 (diff)
downloadtgif-d1b9b76734d2ec31d41ba6e7beddab7c880dff85.tar.xz
Avoid loading commits twice in log with diffs
If you run a log with diffs (such as -p, --raw, --stat etc.) the current code ends up loading many objects twice. For example, for 'log -3000 -p' my instrumentation said the objects loaded more than once are distributed as follows: 2008 blob 2103 commit 2678 tree Fixing blobs and trees will be harder, because those are really used within the diff engine and need some form of caching. However, fixing the commits is easy at least at the band-aid level. They are triggered by log_tree_diff() invoking diff_tree_sha1() on commits, which duly loads the specified object to dereference it to a tree. Since log_tree_diff() knows that it works with commits and they must have trees, we can simply pass through the trees. We add some parse_commit() calls. The ones for the parents are required; we do not know at this stage if they have been looked at. The one for the commit itself is pure paranoia, but has about the same cost as an assertion on commit->object.parsed. This has a quite dramatic effect on log --raw, though only a negligible impact on log -p: Test this tree HEAD -------------------------------------------------------------------- 4000.2: log --raw -3000 0.50(0.43+0.06) 0.54(0.46+0.06) +7.0%*** 4000.3: log -p -3000 2.34(2.20+0.13) 2.37(2.22+0.13) +1.2% -------------------------------------------------------------------- Significance hints: '.' 0.1 '*' 0.05 '**' 0.01 '***' 0.001 Signed-off-by: Thomas Rast <trast@student.ethz.ch> Signed-off-by: Thomas Rast <trast@inf.ethz.ch> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'resolve-undo.h')
0 files changed, 0 insertions, 0 deletions