Skip to content

Commit

Permalink
merge: optimization to skip evaluate_result for single strategy
Browse files Browse the repository at this point in the history
For a merge with a single strategy, the result of evaluate_result() is
effectively not used and therefore is not needed, so avoid altogether.

On Windows, this optimization can halve the time required to perform a
recursive merge of a single commit with the LLVM repo.

Signed-off-by: Andrew Ng <andrew.ng@sony.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
nga888 authored and gitster committed May 19, 2020
1 parent af6b65d commit 8777616
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion builtin/merge.c
Expand Up @@ -1629,7 +1629,7 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
}
merge_was_ok = 1;
}
cnt = evaluate_result();
cnt = (use_strategies_nr > 1) ? evaluate_result() : 0;
if (best_cnt <= 0 || cnt <= best_cnt) {
best_strategy = use_strategies[i]->name;
best_cnt = cnt;
Expand Down

0 comments on commit 8777616

Please sign in to comment.