public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox•com>
To: Johannes Schindelin <Johannes.Schindelin@gmx•de>
Cc: Jeff King <peff@peff•net>,
	Sebastian Schuberth <sschuberth@gmail•com>,
	git@vger•kernel.org, szeder@ira•uka.de, tr@thomasrast•ch
Subject: Re: [PATCH] git-completion.bash: always swallow error output of for-each-ref
Date: Thu, 04 Feb 2016 11:06:58 -0800	[thread overview]
Message-ID: <xmqqwpqki9bh.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <alpine.DEB.2.20.1602041216240.2964@virtualbox> (Johannes Schindelin's message of "Thu, 4 Feb 2016 12:26:19 +0100 (CET)")

Johannes Schindelin <Johannes.Schindelin@gmx•de> writes:

>> $ time git for-each-ref --format='%(refname:short)' refs/tags >/dev/null
>> 
>> real    0m0.009s
>> user    0m0.004s
>> sys     0m0.004s
>
> And the timings in the ticket I mentioned above are not pretty small:
> 0.055s vs 1.341s
>
>> The upcoming refname:strip does much better:
>> 
>> $ time git for-each-ref --format='%(refname:strip=2)' refs/tags >/dev/null
>> 
>> real    0m0.004s
>> user    0m0.000s
>> sys     0m0.004s
>
> This is funny: after reading the commit message at
> https://github.com/git/git/commit/0571979b it eludes me why strip=2 should
> be so much faster than short...

"short" tries to ensure that the result is not ambiguous within the
repository, so when asked to shorten refs/heads/foo, it needs to
check if refs/tags/foo exists.  "strip=2" textually strips two
levels from the top without worrying about ambiguity across
different hierarchies.

  parent reply	other threads:[~2016-02-04 19:07 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-04 10:34 [PATCH] git-completion.bash: always swallow error output of for-each-ref Sebastian Schuberth
2016-02-04 11:13 ` Jeff King
2016-02-04 11:26   ` Johannes Schindelin
2016-02-04 11:45     ` Jeff King
2016-02-04 19:06     ` Junio C Hamano [this message]
2016-02-12 23:21     ` SZEDER Gábor
2016-02-12 23:40       ` Jeff King
2016-02-13  1:07         ` SZEDER Gábor
2016-02-13  9:21           ` Johannes Schindelin
2016-02-13 13:53             ` SZEDER Gábor
2016-02-13 17:14               ` Johannes Schindelin
2016-02-13 16:57           ` Jeff King
2016-02-12 23:43       ` SZEDER Gábor
2016-02-12 23:46         ` Jeff King
2016-02-13  0:53           ` Duy Nguyen
2016-02-12 20:00   ` Junio C Hamano
2016-02-12 20:10     ` Jeff King
2016-02-12 20:26       ` Junio C Hamano
2016-02-12 21:40     ` SZEDER Gábor
2016-02-12 22:16       ` Jeff King
2016-02-12 23:37         ` Junio C Hamano
2016-02-23 23:30           ` Junio C Hamano
2016-02-24  7:48             ` Sebastian Schuberth
2016-02-12  9:23 ` Sebastian Schuberth

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=xmqqwpqki9bh.fsf@gitster.mtv.corp.google.com \
    --to=gitster@pobox$(echo .)com \
    --cc=Johannes.Schindelin@gmx$(echo .)de \
    --cc=git@vger$(echo .)kernel.org \
    --cc=peff@peff$(echo .)net \
    --cc=sschuberth@gmail$(echo .)com \
    --cc=szeder@ira$(echo .)uka.de \
    --cc=tr@thomasrast$(echo .)ch \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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