git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] subtree: performance improvement for finding unexpected parent commits
@ 2018-10-12 13:52 Roger Strain
  2018-10-12 13:55 ` Strain, Roger L.
  2018-10-12 14:22 ` Junio C Hamano
  0 siblings, 2 replies; 3+ messages in thread
From: Roger Strain @ 2018-10-12 13:52 UTC (permalink / raw)
  To: git; +Cc: Roger Strain

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>
---
 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
 
-- 
2.19.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* RE: [PATCH] subtree: performance improvement for finding unexpected parent commits
  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
  1 sibling, 0 replies; 3+ messages in thread
From: Strain, Roger L. @ 2018-10-12 13:55 UTC (permalink / raw)
  To: git@vger.kernel.org

Original failed to include the note that this patch is for the 'next' branch, my apologies.

> -----Original Message-----
> From: Roger Strain <rstrain@swri.org>
> Sent: Friday, October 12, 2018 8:52 AM
> To: git@vger.kernel.org
> Cc: Strain, Roger L. <roger.strain@swri.org>
> Subject: [PATCH] subtree: performance improvement for finding
> unexpected parent commits
> 
> 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>
> ---
>  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
> 
> --
> 2.19.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] subtree: performance improvement for finding unexpected parent commits
  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
  1 sibling, 0 replies; 3+ messages in thread
From: Junio C Hamano @ 2018-10-12 14:22 UTC (permalink / raw)
  To: Roger Strain; +Cc: git

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-10-12 14:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).