]> git.ipfire.org Git - thirdparty/git.git/commitdiff
merge: optimization to skip evaluate_result for single strategy
authorAndrew Ng <andrew.ng@sony.com>
Tue, 19 May 2020 13:05:35 +0000 (14:05 +0100)
committerJunio C Hamano <gitster@pobox.com>
Tue, 19 May 2020 22:35:46 +0000 (15:35 -0700)
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>
builtin/merge.c

index d127d2225f897f111124fb55b12cd1aae7db7a8e..826e2c26560b3201d3719e4b91ef3f4c5d46bb59 100644 (file)
@@ -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;