All of lore.kernel.org
 help / color / mirror / Atom feed
From: anng.sw@gmail.com
To: git@vger.kernel.org
Cc: gitster@pobox.com, eantoranz@gmail.com, Andrew Ng <andrew.ng@sony.com>
Subject: [PATCH] merge: optimization to skip evaluate_result for single strategy
Date: Mon, 18 May 2020 16:36:13 +0100	[thread overview]
Message-ID: <20200518153613.17497-1-anng.sw@gmail.com> (raw)

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 half 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>
---
 builtin/merge.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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


             reply	other threads:[~2020-05-18 15:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-18 15:36 anng.sw [this message]
2020-05-18 17:23 ` [PATCH] merge: optimization to skip evaluate_result for single strategy Junio C Hamano
2020-05-19 13:05 anng.sw

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200518153613.17497-1-anng.sw@gmail.com \
    --to=anng.sw@gmail.com \
    --cc=andrew.ng@sony.com \
    --cc=eantoranz@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.