summaryrefslogtreecommitdiff
path: root/ws.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2009-07-22 21:48:28 (GMT)
committerJunio C Hamano <gitster@pobox.com>2009-07-22 22:37:55 (GMT)
commit55d5d5bab7c3f9ab6310b9cf436a7935d7d32165 (patch)
treecf01cae48bc434249284890c0fab469504504600 /ws.c
parent78d3b06e0f5e6aaea001ee8e3e7c8e401dc4b244 (diff)
downloadgit-55d5d5bab7c3f9ab6310b9cf436a7935d7d32165.zip
git-55d5d5bab7c3f9ab6310b9cf436a7935d7d32165.tar.gz
git-55d5d5bab7c3f9ab6310b9cf436a7935d7d32165.tar.bz2
combine-diff.c: fix performance problem when folding common deleted lines
For a deleted line in a patch with the parent we are looking at, the append_lost() function finds the same line among a run of lines that were deleted from the same location by patches from parents we previously checked. This is so that patches with two parents @@ -1,4 +1,3 @@ @@ -1,4 +1,3 @@ one one -two -two three three -quatro -fyra +four +four can be coalesced into this sequence, reusing one line that describes the removal of "two" for both parents. @@@ -1,4 -1,4 +1,3 @@@ one --two three - quatro -frya ++four While reading the second patch (that removes "two" and then "fyra"), after finding where removal of the "two" matches, we need to find existing removal of "fyra" (if exists) in the removal list, but the match has to happen after all the existing matches (in this case "two"). The code used a naïve O(n^2) algorithm to compute this by scanning the whole removal list over and over again. This patch remembers where the next scan should be started in the existing removal list to avoid this. Noticed by Linus Torvalds. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'ws.c')
0 files changed, 0 insertions, 0 deletions