summaryrefslogtreecommitdiff
path: root/tree.c
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2008-01-29 20:54:56 -0800
committerLibravatar Junio C Hamano <gitster@pobox.com>2008-02-13 15:44:20 -0800
commit6d24ad971c8195b00cd9678fbff7c2aaddb00908 (patch)
treec7c87ecec384bdb47abe67e98f704a5bb68c860e /tree.c
parentman pages are littered with .ft C and others (diff)
downloadtgif-6d24ad971c8195b00cd9678fbff7c2aaddb00908.tar.xz
Optimize rename detection for a huge diff
When there are N deleted paths and M created paths, we used to allocate (N x M) "struct diff_score" that record how similar each of the pair is, and picked the <src,dst> pair that gives the best match first, and then went on to process worse matches. This sorting is done so that when two new files in the postimage that are similar to the same file deleted from the preimage, we can process the more similar one first, and when processing the second one, it can notice "Ah, the source I was planning to say I am a copy of is already taken by somebody else" and continue on to match itself with another file in the preimage with a lessor match. This matters to a change introduced between 1.5.3.X series and 1.5.4-rc, that lets the code to favor unused matches first and then falls back to using already used matches. This instead allocates and keeps only a handful rename source candidates per new files in the postimage. I.e. it makes the memory requirement from O(N x M) to O(M). For each dst, we compute similarlity with all sources (i.e. the number of similarity estimate computations is still O(N x M)), but we keep handful best src candidates for each dst. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'tree.c')
0 files changed, 0 insertions, 0 deletions