mirror of
https://github.com/git/git.git
synced 2025-12-12 20:36:24 +01:00
Merge branch 'yc/xdiff-patience-optim'
The way patience diff finds LCS has been optimized. * yc/xdiff-patience-optim: xdiff: optimize patience diff's LCS search
This commit is contained in:
@@ -211,7 +211,10 @@ static int find_longest_common_sequence(struct hashmap *map, struct entry **res)
|
|||||||
for (entry = map->first; entry; entry = entry->next) {
|
for (entry = map->first; entry; entry = entry->next) {
|
||||||
if (!entry->line2 || entry->line2 == NON_UNIQUE)
|
if (!entry->line2 || entry->line2 == NON_UNIQUE)
|
||||||
continue;
|
continue;
|
||||||
i = binary_search(sequence, longest, entry);
|
if (longest == 0 || entry->line2 > sequence[longest - 1]->line2)
|
||||||
|
i = longest - 1;
|
||||||
|
else
|
||||||
|
i = binary_search(sequence, longest, entry);
|
||||||
entry->previous = i < 0 ? NULL : sequence[i];
|
entry->previous = i < 0 ? NULL : sequence[i];
|
||||||
++i;
|
++i;
|
||||||
if (i <= anchor_i)
|
if (i <= anchor_i)
|
||||||
|
|||||||
Reference in New Issue
Block a user