From: Tian Yuchen <a3205153416@gmail.com>
To: Junio C Hamano <gitster@pobox.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: Thu, 12 Feb 2026 00:43:03 +0800 [thread overview]
Message-ID: <83365a16-68c2-4429-926e-3071df3b9bfb@gmail.com> (raw)
In-Reply-To: <xmqqqzqsw4og.fsf@gitster.g>
On 2/11/26 07:37, Junio C Hamano wrote:
> 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.
Hi Junio,
I completely agree that computing it once and storing it in
'istate->repo' is the right fix. Optimizing for logical clarity and
reducing load is indeed more important than micro-benchmarking here.
Thanks for the insight!
Regards,
Yuchen
prev parent reply other threads:[~2026-02-11 16:43 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
2026-02-11 16:43 ` Tian Yuchen [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=83365a16-68c2-4429-926e-3071df3b9bfb@gmail.com \
--to=a3205153416@gmail.com \
--cc=ayu.chandekar@gmail.com \
--cc=christian.couder@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox