git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Bagas Sanjaya <bagasdotme@gmail.com>
Cc: John Cai <johncai86@gmail.com>,
	git@vger.kernel.org, avarab@gmail.com, me@ttaylorr.com,
	phillip.wood123@gmail.com, e@80x24.org
Subject: Re: [RFC v3] cat-file: add a --stdin-cmd mode
Date: Mon, 31 Jan 2022 10:24:26 -0800	[thread overview]
Message-ID: <xmqqpmo7ix0l.fsf@gitster.g> (raw)
In-Reply-To: <56f851f3-946b-0524-1643-25799ef46b55@gmail.com> (Bagas Sanjaya's message of "Mon, 31 Jan 2022 18:44:20 +0700")

Bagas Sanjaya <bagasdotme@gmail.com> writes:

> On 29/01/22 01.33, John Cai wrote:
>> Future improvements:
>> - a non-trivial part of "cat-file --batch" time is spent
>> on parsing its argument and seeing if it's a revision, ref etc. So we
>> could add a command that only accepts a full-length 40
>> character SHA-1.
>
> I think the full hash is actually revision name.

There is no entry for "revision name" in Documentation/glossary-content.txt
;-)

But to John, if you have a loop that feedseach line to get_oid(), 

	while (getline(buf)) {
		struct object_id oid;
		if (get_oid(buf, &oid))
			warn and continue;
		use oid;
	}

is it much slower than a mode that can ONLY handle a full object
name input, i.e.

	while (getline(buf)) {
		struct object_id oid;
		if (get_oid_hex(buf, &oid))
			warn and continue;
		use oid;
	}

when your input is restricted to full object names?

get_oid() == repo_get_oid()
-> get_oid_with_context()
   -> get_oid_with_context_1()
      -> get_oid_1()
	 -> peel_onion()
	 -> get_oid_basic()
	    -> get_oid_hex()
	    -> repo_dwim_ref()

it seems that warn_ambiguous_refs and warn_on_object_refname_ambiguity
we would waste time on refname discovery but I see cat-file already
has some provision to disable this check.  So when we do not need to
call repo_dwim_ref(), do we still spend measurable cycles in this
callchain?






  reply	other threads:[~2022-01-31 18:24 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-28 18:33 [RFC v3] cat-file: add a --stdin-cmd mode John Cai
2022-01-31 11:44 ` Bagas Sanjaya
2022-01-31 18:24   ` Junio C Hamano [this message]
2022-02-01  9:48     ` Ævar Arnfjörð Bjarmason
2022-02-01  9:39 ` Christian Couder
2022-02-01 17:52   ` Taylor Blau
2022-02-01 19:27     ` John Cai
2022-02-01 20:14       ` Taylor Blau
     [not found]         ` <3FE1D509-8AD0-4F0E-9298-DFD3552A98EF@gmail.com>
2022-02-02  1:45           ` Taylor Blau
2022-02-02 13:11   ` John Cai
2022-02-01 10:43 ` Phillip Wood
2022-02-02 15:05   ` John Cai

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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqpmo7ix0l.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=avarab@gmail.com \
    --cc=bagasdotme@gmail.com \
    --cc=e@80x24.org \
    --cc=git@vger.kernel.org \
    --cc=johncai86@gmail.com \
    --cc=me@ttaylorr.com \
    --cc=phillip.wood123@gmail.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.
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).