From: Junio C Hamano <gitster@pobox.com>
To: "Maik Riechert via GitGitGadget" <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org, Eric Sunshine <sunshine@sunshineco.com>,
Patrick Steinhardt <ps@pks.im>,
Maik Riechert <letmaik@outlook.com>
Subject: Re: [PATCH] worktree add: skip HEAD reads for destination checks
Date: Sat, 28 Nov 2026 21:01:01 -0800 [thread overview]
Message-ID: <xmqqzeusp6ya.fsf@gitster.g> (raw)
In-Reply-To: <pull.2339.git.1795907202117.gitgitgadget@gmail.com> (Maik Riechert via GitGitGadget's message of "Sat, 28 Nov 2026 23:06:42 +0000")
"Maik Riechert via GitGitGadget" <gitgitgadget@gmail.com> writes:
> From: Maik Riechert <letmaik@outlook.com>
>
> add_worktree() calls get_worktrees() to check whether the destination
> matches a registered worktree. This also resolves HEAD for the
> enumerated worktrees, although check_candidate_path() only needs their
> paths, IDs and lock state.
>
> Use get_worktrees_without_reading_head() for the destination check to
> avoid these unnecessary lookups.
>
> Detached git worktree add --no-checkout with 200 existing linked
> worktrees. Median of seven runs per version, with warm caches:
This is a very minor nit, but the above reads like a note fragment
without a verb. Something like "Measured with 'git worktree add
--detach --no-checkout' on a repository with 200 existing linked
worktrees (median of seven runs per version, warm caches)" might read a
bit more smoothly.
> before after
> files 11.13 ms 6.77 ms
> reftable 18.86 ms 7.60 ms
Nice to see that avoiding extra work yields a simple, straightforward,
and expected payoff ;-)
next prev parent reply other threads:[~2026-11-29 5:01 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-28 23:06 [PATCH] worktree add: skip HEAD reads for destination checks Maik Riechert via GitGitGadget
2026-11-29 5:01 ` Junio C Hamano [this message]
2026-11-29 5:41 ` [PATCH v2] " Maik Riechert via GitGitGadget
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=xmqqzeusp6ya.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=gitgitgadget@gmail.com \
--cc=letmaik@outlook.com \
--cc=ps@pks.im \
--cc=sunshine@sunshineco.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.