git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH 0/2] Accelerate "git merge-base --is-ancestor"
@ 2020-06-17 17:24 Derrick Stolee via GitGitGadget
  2020-06-17 17:24 ` [PATCH 1/2] commit-reach: create repo_is_descendant_of() Derrick Stolee via GitGitGadget
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Derrick Stolee via GitGitGadget @ 2020-06-17 17:24 UTC (permalink / raw)
  To: git; +Cc: szeder.dev, avarab, abhishekkumar8222, me, Derrick Stolee

It was recently [1] reported (and not-so-recently [2] reported) that "git
merge-base --is-ancestor" can be pretty slow. In fact, it is regularly
slower than "git branch --contains" or "git tag --contains", which are
answering a "harder" query.

[1] https://lore.kernel.org/git/20200607195347.GA8232@szeder.dev/

[2] https://lore.kernel.org/git/87608bawoa.fsf@evledraar.gmail.com/

The root cause is that the in_merge_base() implementation is skipping the
fast can_all_from_reach() implementation and using paint_down_to_common()
instead. Note that these are equivalent: a commit A is in the set of
merge-bases between A and B if and only if B can reach A.

This fixes the issue, and makes the performance degradation reported by
Szeder a non-issue.

Thanks, -Stolee

Derrick Stolee (2):
  commit-reach: create repo_is_descendant_of()
  commit-reach: use fast logic in repo_in_merge_base

 commit-reach.c | 21 ++++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)


base-commit: b3d7a52fac39193503a0b6728771d1bf6a161464
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-664%2Fderrickstolee%2Fmerge-base-is-ancestor-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-664/derrickstolee/merge-base-is-ancestor-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/664
-- 
gitgitgadget

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2020-06-30  1:45 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-17 17:24 [PATCH 0/2] Accelerate "git merge-base --is-ancestor" Derrick Stolee via GitGitGadget
2020-06-17 17:24 ` [PATCH 1/2] commit-reach: create repo_is_descendant_of() Derrick Stolee via GitGitGadget
2020-06-29 13:40   ` Taylor Blau
2020-06-30  1:45     ` Derrick Stolee
2020-06-17 17:24 ` [PATCH 2/2] commit-reach: use fast logic in repo_in_merge_base Derrick Stolee via GitGitGadget
2020-06-17 20:46 ` [PATCH 0/2] Accelerate "git merge-base --is-ancestor" Junio C Hamano
2020-06-18  1:37   ` Derrick Stolee
2020-06-19  6:10 ` Abhishek Kumar

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).