git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Derrick Stolee <derrickstolee@github.com>
To: Jeff King <peff@peff.net>,
	Derrick Stolee via GitGitGadget <gitgitgadget@gmail.com>
Cc: Junio C Hamano <gitster@pobox.com>,
	git@vger.kernel.org, vdye@github.com, me@ttaylorr.com,
	mjcheetham@outlook.com
Subject: Re: [PATCH 2/2] for-each-ref: add --count-matches option
Date: Mon, 10 Jul 2023 10:51:25 -0600	[thread overview]
Message-ID: <4715a469-8c68-8dcc-0254-9b7b857c3722@github.com> (raw)
In-Reply-To: <20230627073007.GD1226768@coredump.intra.peff.net>

On 6/27/2023 1:30 AM, Jeff King wrote:
>On Mon, Jun 26, 2023 at 03:09:57PM +0000, Derrick Stolee via GitGitGadget wrote:
>
>>+for pattern in "refs/heads/" "refs/tags/" "refs/remotes"
>>+do
>>+   test_perf "count $pattern: git for-each-ref | wc -l" "
>>+       git for-each-ref $pattern | wc -l
>>+   "
>>+
>>+   test_perf "count $pattern: git for-each-ref --count-match" "
>>+       git for-each-ref --count-matches $pattern
>>+   "
>>+done
>
>I don't think this is a very realistic perf test, because for-each-ref
>is doing a bunch of work to generate its default format, only to have
>"wc" throw most of it away. Doing:
>
>  git for-each-ref --format='%(refname)' | wc -l
>
>is much better (obviously you have to remember to do that if you care
>about optimizing your command, but that's true of --count-matches, too).
Thank you for pointing this out! I'll be sure to modify the test and the
analysis about it.
The other check I need to compare is when multiple refspecs are provided
at the same time, which I do believe still is a valuable thing to combine
into a single process instead of multiple pipes to 'wc'.
Did you have any thoughts on whether or not this works as an option in
'git for-each-ref' or would be better broken into a new builtin?
Thanks,
-Stolee

      parent reply	other threads:[~2023-07-10 16:51 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-26 15:09 [PATCH 0/2] [RFC] for-each-ref: add --count-matches mode Derrick Stolee via GitGitGadget
2023-06-26 15:09 ` [PATCH 1/2] for-each-ref: extract ref output loop Derrick Stolee via GitGitGadget
2023-06-26 15:09 ` [PATCH 2/2] for-each-ref: add --count-matches option Derrick Stolee via GitGitGadget
2023-06-26 16:14   ` Junio C Hamano
2023-06-27  7:30   ` Jeff King
2023-06-27 10:05     ` Phillip Wood
2023-06-27 18:22       ` Junio C Hamano
2023-06-27 19:59         ` Jeff King
2023-06-28 13:12       ` Phillip Wood
2023-06-28 17:08         ` Junio C Hamano
2023-07-11 14:48       ` René Scharfe
2023-07-10 16:51     ` Derrick Stolee [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=4715a469-8c68-8dcc-0254-9b7b857c3722@github.com \
    --to=derrickstolee@github.com \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=gitster@pobox.com \
    --cc=me@ttaylorr.com \
    --cc=mjcheetham@outlook.com \
    --cc=peff@peff.net \
    --cc=vdye@github.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 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).