path: root/ws.c
diff options
authorJunio C Hamano <>2009-07-22 21:48:28 (GMT)
committerJunio C Hamano <>2009-07-22 22:37:55 (GMT)
commit55d5d5bab7c3f9ab6310b9cf436a7935d7d32165 (patch)
treecf01cae48bc434249284890c0fab469504504600 /ws.c
parent78d3b06e0f5e6aaea001ee8e3e7c8e401dc4b244 (diff)
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 <>
Diffstat (limited to 'ws.c')
0 files changed, 0 insertions, 0 deletions