threads / patch / 53502

patchmerge: optimization to skip evaluate_result for single strategy

Subject: [PATCH] merge: optimization to skip evaluate_result for single strategy

## tl;dr

One message between May 19, 2020 and May 19, 2020. Diffs are folded; open one to read it.

replies: 0people: 1as markdown or json

anng.sw@gmail.com· May 19, 2020, 13:05 UTC · lore
From: Andrew Ng <andrew.ng@sony.com>

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>
Reviewed-by: Junio C Hamano <gitster@pobox.com>
---
 builtin/merge.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Show changes to builtin/merge.c +1 −1
diff --git a/builtin/merge.c b/builtin/merge.c
index ca6a5dc4bf..7da707bf55 100644
--- a/builtin/merge.c
+++ b/builtin/merge.c
@@ -1656,7 +1656,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;
-- 
2.26.2.windows.1

← back to recent threads