From: Junio C Hamano <gitster@pobox.com>
To: "Uwe Kleine-König" <u.kleine-koenig@baylibre.com>
Cc: git@vger.kernel.org, Jeff King <peff@peff.net>,
"D. Ben Knoble" <ben.knoble@gmail.com>
Subject: Re: first bisection step takes quite a while
Date: Fri, 21 Feb 2025 09:29:25 -0800 [thread overview]
Message-ID: <xmqqo6yvb40a.fsf@gitster.g> (raw)
In-Reply-To: <4hx5uvjy7mzntb5zp6o4dg3ut44i46bthyfuera3lnbpbcvrey@kbo3ejype7ae> ("Uwe Kleine-König"'s message of "Fri, 21 Feb 2025 10:28:24 +0100")
Uwe Kleine-König <u.kleine-koenig@baylibre.com> writes:
> Hello Junio,
>
> On Thu, Feb 20, 2025 at 05:40:53PM -0800, Junio C Hamano wrote:
>> Comments?
>
> It's long time ago that I looked into the git source code and I guess
> many things have changed since then.
;-) Apparently not much has changed around this area. I was amazed
how things haven't changed around the code since I wrote it in 2007
with "the clever trick" to improve what Linus called "truly stupid"
algorithm. No, I didn't improve the stupid algorithm. The clever
trick was to reduce the need to call it.
> Anyhow, here comes my thought about how finding a bisection point could
> work.
>
> Pick the middle commit of `git rev-list --topo-order $bad ^$allgood`.
> Lets assume this are 10000 commits. Check the weight of commit[5000].
> Depending on how much the weight is off from 5000 make a bigger or a
> smaller step up or down to find the next commit to check. So a scaled
> bisection on the topo-order commit list. I think that doesn't
> necessarily finds a best bisection point, but I havn't thought about
> that a lot.
Since the name of the game is to find "a" good enough point in the
earlier part of a huge bisection session, that certainly is good way
to think about the problem space. The commit[] array you have may
not be a linear single-strand-of-pearls history, and a naïve
bisection would not work well in such a case, so we have to be a bit
more careful here.
The code I touched in the illustration needs to either find a merge
commit that is really good enough and leave early, or if there is no
such merge commit, compute how many other commits in the range each
and every merge commit in the range that can be the ancestor of
the best non-merge commit on a single-strand-of-pearls history.
Thanks.
prev parent reply other threads:[~2025-02-21 17:29 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-20 14:35 first bisection step takes quite a while Uwe Kleine-König
2025-02-20 18:44 ` D. Ben Knoble
2025-02-20 19:17 ` Junio C Hamano
2025-02-21 1:40 ` Junio C Hamano
2025-02-21 9:15 ` Christian Couder
2025-02-21 17:47 ` Junio C Hamano
2025-02-21 20:24 ` Christian Couder
2025-02-21 23:06 ` Christian Couder
2025-02-22 2:15 ` Junio C Hamano
2025-02-24 17:27 ` D. Ben Knoble
2025-02-21 9:28 ` Uwe Kleine-König
2025-02-21 17:29 ` Junio C Hamano [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=xmqqo6yvb40a.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=ben.knoble@gmail.com \
--cc=git@vger.kernel.org \
--cc=peff@peff.net \
--cc=u.kleine-koenig@baylibre.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;
as well as URLs for NNTP newsgroup(s).