{"thread":{"id":"53502","subject":"[PATCH] merge: optimization to skip evaluate_result for single strategy","startedAt":"2020-05-19T13:05:58Z","lastAt":"2020-05-19T13:05:58Z","messageCount":1,"participants":["anng.sw@gmail.com"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"398199","messageId":"20200519130535.23770-1-anng.sw@gmail.com","threadId":"53502","inReplyTo":null,"subject":"[PATCH] merge: optimization to skip evaluate_result for single strategy","fromName":"","fromEmail":"anng.sw@gmail.com","sentAt":"2020-05-19T13:05:35Z","receivedAt":"2020-05-19T13:05:58Z","isPatch":true,"sender":{"key":"anng.sw@gmail.com","avatar":null},"body":"From: Andrew Ng <andrew.ng@sony.com>\n\nFor a merge with a single strategy, the result of evaluate_result() is\neffectively not used and therefore is not needed, so avoid altogether.\n\nOn Windows, this optimization can halve the time required to perform a\nrecursive merge of a single commit with the LLVM repo.\n\nSigned-off-by: Andrew Ng <andrew.ng@sony.com>\nReviewed-by: Junio C Hamano <gitster@pobox.com>\n---\n builtin/merge.c | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/builtin/merge.c b/builtin/merge.c\nindex ca6a5dc4bf..7da707bf55 100644\n--- a/builtin/merge.c\n+++ b/builtin/merge.c\n@@ -1656,7 +1656,7 @@ int cmd_merge(int argc, const char **argv, const char *prefix)\n \t\t\t\t}\n \t\t\t\tmerge_was_ok = 1;\n \t\t\t}\n-\t\t\tcnt = evaluate_result();\n+\t\t\tcnt = (use_strategies_nr > 1) ? evaluate_result() : 0;\n \t\t\tif (best_cnt <= 0 || cnt <= best_cnt) {\n \t\t\t\tbest_strategy = use_strategies[i]->name;\n \t\t\t\tbest_cnt = cnt;\n-- \n2.26.2.windows.1\n\n"}]}