From: Junio C Hamano <gitster@pobox.com>
To: Tian Yuchen <a3205153416@gmail.com>
Cc: Ayush Jha <kumarayushjha123@gmail.com>,
git@vger.kernel.org,
Christian Couder <christian.couder@gmail.com>,
Karthik Nayak <karthik.188@gmail.com>,
Justin Tobler <jltobler@gmail.com>,
Ayush Chandekar <ayu.chandekar@gmail.com>,
Siddharth Asthana <siddharthasthana31@gmail.com>,
Lucas Seiki Oshiro <lucasseikioshiro@gmail.com>
Subject: Re: [PATCH] [RFC][GSoC][PATCH] attr: use local repository state in read_attr
Date: Tue, 10 Feb 2026 15:37:51 -0800 [thread overview]
Message-ID: <xmqqqzqsw4og.fsf@gitster.g> (raw)
In-Reply-To: <96329bc6-0490-454b-a21b-babb85c98bc9@gmail.com> (Tian Yuchen's message of "Sun, 8 Feb 2026 12:42:07 +0800")
Tian Yuchen <a3205153416@gmail.com> writes:
> Junio C Hamano <gitster@pobox.com> writes:
>
> >The codepath read_attr() is in is usually not that hot but it is not
> >cheap.
>
> I'm a bit curious—under what circumstances would calling this method
> result in significant performance regression?
Significant? I dunno.
And quite honestly, I do not care about significance very much in a
case like this. Doing things that do not make sense, like checking
the same configuration variable again and again when you _know_ that
you never switched to a different repository since you last checked,
is simply wrong. It burdens the readers with unnecessary cognitive
load by making them wonder why you do such a nonsensical thing.
The read_attr() is called during an attr stack construction, which
traverses the directory hierarchy of a single repositry's working
tree (we do not traverse across submodule boundaries), and the same
istate (i.e., index contents) structure is passed around throughout
the callchain. The repository instance at istate->repo may be a
good place to store "am I bare?" bit that is computed just once and
reused whenever we need to know, like in the funcion under
discussion.
next prev parent reply other threads:[~2026-02-10 23:37 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-07 11:40 [PATCH] [RFC][GSoC][PATCH] attr: use local repository state in read_attr Ayush Jha
2026-02-07 19:12 ` Tian Yuchen
2026-02-07 21:02 ` Lucas Seiki Oshiro
2026-02-07 21:41 ` Junio C Hamano
2026-02-08 4:42 ` Tian Yuchen
2026-02-10 14:05 ` Ayush Jha
2026-02-14 0:04 ` Lucas Seiki Oshiro
2026-02-14 6:47 ` Ayush Jha
2026-02-10 23:37 ` Junio C Hamano [this message]
2026-02-11 16:43 ` Tian Yuchen
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=xmqqqzqsw4og.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=a3205153416@gmail.com \
--cc=ayu.chandekar@gmail.com \
--cc=christian.couder@gmail.com \
--cc=git@vger.kernel.org \
--cc=jltobler@gmail.com \
--cc=karthik.188@gmail.com \
--cc=kumarayushjha123@gmail.com \
--cc=lucasseikioshiro@gmail.com \
--cc=siddharthasthana31@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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.