{"thread":{"id":"49548","subject":"[PATCH] subtree: performance improvement for finding unexpected parent commits","startedAt":"2018-10-12T13:52:36Z","lastAt":"2018-10-12T14:22:12Z","messageCount":3,"participants":["Roger Strain","Strain, Roger L.","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"360311","messageId":"20181012135218.14439-1-rstrain@swri.org","threadId":"49548","inReplyTo":null,"subject":"[PATCH] subtree: performance improvement for finding unexpected parent commits","fromName":"Roger Strain","fromEmail":"rstrain@swri.org","sentAt":"2018-10-12T13:52:18Z","receivedAt":"2018-10-12T13:52:36Z","isPatch":true,"sender":{"key":"rstrain@swri.org","avatar":"https://gravatar.com/avatar/8c08dc63d400a738e756b1d45fb5d0562bd397477bde48a14c012c144150090b?d=mp&s=160"},"body":"After testing a previous patch at larger scale, a performance issue was\ndetected when using git show to locate parent revisions, with a single\nrun of the git show command taking 2 seconds or longer in a complex repo.\nWhen the command is required tens or hundreds of times in a run of the\nscript, the additional wait time is unaccepatable. Replacing the command\nwith git rev-parse resulted in significantly increased performance, with\nthe command in question returning instantly.\n\nSigned-off-by: Roger Strain <rstrain@swri.org>\nThanks-to: Junio C Hamano <gitster@pobox.com>\n---\n contrib/subtree/git-subtree.sh | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh\nindex 1c157dbd9..147201dc6 100755\n--- a/contrib/subtree/git-subtree.sh\n+++ b/contrib/subtree/git-subtree.sh\n@@ -633,7 +633,7 @@ process_split_commit () {\n \telse\n \t\t# processing commit without normal parent information;\n \t\t# fetch from repo\n-\t\tparents=$(git show -s --pretty=%P \"$rev\")\n+\t\tparents=$(git rev-parse \"$rev^@\")\n \t\textracount=$(($extracount + 1))\n \tfi\n \n-- \n2.19.1\n\n"},{"id":"360312","messageId":"b4163622de7442849e7f3f118db0c0ea@MBX260.adm.swri.edu","threadId":"49548","inReplyTo":"20181012135218.14439-1-rstrain@swri.org","subject":"RE: [PATCH] subtree: performance improvement for finding unexpected parent commits","fromName":"Strain, Roger L.","fromEmail":"roger.strain@swri.org","sentAt":"2018-10-12T13:55:16Z","receivedAt":"2018-10-12T13:55:19Z","isPatch":true,"sender":{"key":"roger.strain@swri.org","avatar":"https://avatars.githubusercontent.com/u/52041877?v=4"},"body":"Original failed to include the note that this patch is for the 'next' branch, my apologies.\n\n> -----Original Message-----\n> From: Roger Strain <rstrain@swri.org>\n> Sent: Friday, October 12, 2018 8:52 AM\n> To: git@vger.kernel.org\n> Cc: Strain, Roger L. <roger.strain@swri.org>\n> Subject: [PATCH] subtree: performance improvement for finding\n> unexpected parent commits\n> \n> After testing a previous patch at larger scale, a performance issue was\n> detected when using git show to locate parent revisions, with a single run of\n> the git show command taking 2 seconds or longer in a complex repo.\n> When the command is required tens or hundreds of times in a run of the\n> script, the additional wait time is unaccepatable. Replacing the command\n> with git rev-parse resulted in significantly increased performance, with the\n> command in question returning instantly.\n> \n> Signed-off-by: Roger Strain <rstrain@swri.org>\n> Thanks-to: Junio C Hamano <gitster@pobox.com>\n> ---\n>  contrib/subtree/git-subtree.sh | 2 +-\n>  1 file changed, 1 insertion(+), 1 deletion(-)\n> \n> diff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh\n> index 1c157dbd9..147201dc6 100755\n> --- a/contrib/subtree/git-subtree.sh\n> +++ b/contrib/subtree/git-subtree.sh\n> @@ -633,7 +633,7 @@ process_split_commit () {\n>  \telse\n>  \t\t# processing commit without normal parent information;\n>  \t\t# fetch from repo\n> -\t\tparents=$(git show -s --pretty=%P \"$rev\")\n> +\t\tparents=$(git rev-parse \"$rev^@\")\n>  \t\textracount=$(($extracount + 1))\n>  \tfi\n> \n> --\n> 2.19.1\n\n"},{"id":"360315","messageId":"xmqqmurj9re9.fsf@gitster-ct.c.googlers.com","threadId":"49548","inReplyTo":"20181012135218.14439-1-rstrain@swri.org","subject":"Re: [PATCH] subtree: performance improvement for finding unexpected parent commits","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2018-10-12T14:22:06Z","receivedAt":"2018-10-12T14:22:12Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Roger Strain <rstrain@swri.org> writes:\n\n> After testing a previous patch at larger scale, a performance issue was\n> detected when using git show to locate parent revisions, with a single\n> run of the git show command taking 2 seconds or longer in a complex repo.\n> When the command is required tens or hundreds of times in a run of the\n> script, the additional wait time is unaccepatable. Replacing the command\n> with git rev-parse resulted in significantly increased performance, with\n> the command in question returning instantly.\n>\n> Signed-off-by: Roger Strain <rstrain@swri.org>\n> Thanks-to: Junio C Hamano <gitster@pobox.com>\n\nThat usually is spelled as \"Helped-by:\".\n\nWill queue.  Thanks.\n\nI still find it disturbing not to know why \"show -s --format=...\"\ntakes measurable time, though.  \"-s\" means \"we do not need any diff\noutput\", so it ought to be comparable to \"git cat-file commit $rev\"\nwith some formatting, but apparently your repository is making Git\nspend a lot more than that.  Puzzled...\n\n> ---\n>  contrib/subtree/git-subtree.sh | 2 +-\n>  1 file changed, 1 insertion(+), 1 deletion(-)\n>\n> diff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh\n> index 1c157dbd9..147201dc6 100755\n> --- a/contrib/subtree/git-subtree.sh\n> +++ b/contrib/subtree/git-subtree.sh\n> @@ -633,7 +633,7 @@ process_split_commit () {\n>  \telse\n>  \t\t# processing commit without normal parent information;\n>  \t\t# fetch from repo\n> -\t\tparents=$(git show -s --pretty=%P \"$rev\")\n> +\t\tparents=$(git rev-parse \"$rev^@\")\n>  \t\textracount=$(($extracount + 1))\n>  \tfi\n"}]}