Repository navigation
Conversation
Author
|
/submit |
|
Submitted as pull.2339.git.1795907202117.gitgitgadget@gmail.com To fetch this version into To fetch this version to local tag |
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.
Measured with 'git worktree add --detach --no-checkout' on a repository
with 200 existing linked worktrees (median of seven runs per version,
warm caches):
before after
files 11.13 ms 6.77 ms
reftable 18.86 ms 7.60 ms
Signed-off-by: Maik Riechert <letmaik@outlook.com>
letmaik
force-pushed
the
worktree-add-path-checks
branch
from
November 29, 2026 05:38
1794646 to
054d208
Compare
Author
|
/submit |
|
Submitted as pull.2339.v2.git.1795930874388.gitgitgadget@gmail.com To fetch this version into To fetch this version to local tag |
|
Junio C Hamano wrote on the Git mailing list (how to reply to this email): "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 ;-)
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes since v1:
Reworded the benchmark introduction as suggested by Junio. No code changes.
CC: Eric Sunshine sunshine@sunshineco.com, Patrick Steinhardt ps@pks.im