From: Junio C Hamano <gitster@pobox.com>
To: Roger Strain <rstrain@swri.org>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] subtree: performance improvement for finding unexpected parent commits
Date: Fri, 12 Oct 2018 23:22:06 +0900	[thread overview]
Message-ID: <xmqqmurj9re9.fsf@gitster-ct.c.googlers.com> (raw)
In-Reply-To: <20181012135218.14439-1-rstrain@swri.org> (Roger Strain's message of "Fri, 12 Oct 2018 08:52:18 -0500")
Roger Strain <rstrain@swri.org> writes:
> After testing a previous patch at larger scale, a performance issue was
> detected when using git show to locate parent revisions, with a single
> run of the git show command taking 2 seconds or longer in a complex repo.
> When the command is required tens or hundreds of times in a run of the
> script, the additional wait time is unaccepatable. Replacing the command
> with git rev-parse resulted in significantly increased performance, with
> the command in question returning instantly.
>
> Signed-off-by: Roger Strain <rstrain@swri.org>
> Thanks-to: Junio C Hamano <gitster@pobox.com>
That usually is spelled as "Helped-by:".
Will queue.  Thanks.
I still find it disturbing not to know why "show -s --format=..."
takes measurable time, though.  "-s" means "we do not need any diff
output", so it ought to be comparable to "git cat-file commit $rev"
with some formatting, but apparently your repository is making Git
spend a lot more than that.  Puzzled...
> ---
>  contrib/subtree/git-subtree.sh | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh
> index 1c157dbd9..147201dc6 100755
> --- a/contrib/subtree/git-subtree.sh
> +++ b/contrib/subtree/git-subtree.sh
> @@ -633,7 +633,7 @@ process_split_commit () {
>  	else
>  		# processing commit without normal parent information;
>  		# fetch from repo
> -		parents=$(git show -s --pretty=%P "$rev")
> +		parents=$(git rev-parse "$rev^@")
>  		extracount=$(($extracount + 1))
>  	fi
     prev parent reply	other threads:[~2018-10-12 14:22 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-12 13:52 [PATCH] subtree: performance improvement for finding unexpected parent commits Roger Strain
2018-10-12 13:55 ` Strain, Roger L.
2018-10-12 14:22 ` Junio C Hamano [this message]
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=xmqqmurj9re9.fsf@gitster-ct.c.googlers.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=rstrain@swri.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).