From 8777616e4db2868609bc42a4c66cc69d23532dbc Mon Sep 17 00:00:00 2001 From: Andrew Ng Date: Tue, 19 May 2020 14:05:35 +0100 Subject: [PATCH] merge: optimization to skip evaluate_result for single strategy 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 Signed-off-by: Junio C Hamano --- builtin/merge.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builtin/merge.c b/builtin/merge.c index d127d2225f897f..826e2c26560b32 100644 --- a/builtin/merge.c +++ b/builtin/merge.c @@ -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;