]> git.ipfire.org Git - thirdparty/git.git/commit - tree-diff.c
tree-diff: reuse base str(buf) memory on sub-tree recursion
authorKirill Smelkov <kirr@mns.spb.ru>
Thu, 27 Mar 2014 14:22:07 +0000 (18:22 +0400)
committerJunio C Hamano <gitster@pobox.com>
Thu, 27 Mar 2014 18:52:35 +0000 (11:52 -0700)
commit12cd81743dc4645ef909b0c38582f5714c9a8ff7
treeac49c4bc72a1efd191ef859c74a2fd6f0632e73d
parentb9081a657446ac2c5e2129de183edb41d4b4f4fb
tree-diff: reuse base str(buf) memory on sub-tree recursion

Instead of allocating it all the time for every subtree in
ll_diff_tree_sha1, let's allocate it once in diff_tree_sha1, and then
all callee just use it in stacking style, without memory allocations.

This should be faster, and for me this change gives the following
slight speedups for

    git log --raw --no-abbrev --no-renames --format='%H'

                navy.git    linux.git v3.10..v3.11

    before      0.618s      1.903s
    after       0.611s      1.889s
    speedup     1.1%        0.7%

Signed-off-by: Kirill Smelkov <kirr@mns.spb.ru>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
tree-diff.c