git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christian Couder <chriscool@tuxfamily.org>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, Ingo Molnar <mingo@elte.hu>,
	John Tapsell <johnflux@gmail.com>,
	Johannes Schindelin <Johannes.Schindelin@gmx.de>,
	Thomas Rast <trast@student.ethz.ch>
Subject: Re: [PATCH v2.1 resend] rev-list: estimate number of bisection step left
Date: Sat, 21 Feb 2009 18:12:55 +0100	[thread overview]
Message-ID: <200902211812.56593.chriscool@tuxfamily.org> (raw)
In-Reply-To: <7vy6w0qgwr.fsf@gitster.siamese.dyndns.org>

Le samedi 21 février 2009, Junio C Hamano a écrit :
> Christian Couder <chriscool@tuxfamily.org> writes:
> > Here is a table to help analyse what should be the best estimate for
> > the number of bisect steps left.
> > ...
> > So the algorithm used in this patch calculates 2^n and x, and then
> > choose between returning n - 1 and n.
>
> Two dumb questions about the math (because I suck at math).
>
>  - Do you mean by "best estimate" the best case scenario, or something
>    else (perhaps "the most accurate")?

I mean the number of steps that has the highest frequency of occurrence, if 
we suppose that:

1) we are in the linear case, and that
2) the first bad revision has an equal chance of being any of the unknown 
(Ux) and the bad (B) revisions.

>  - Is computing based on linear history a good enough approximation?

I think so. Before I sent patch v1, I tested it on some non linear cases and 
it worked quite well in those cases as well. I think the bisect algorithm 
tries as best as possible to remove half the revisions from the set of the 
possible first bad revisions and this means that all the algorithms based 
on log2(all) should be quite good in any case.

> I am not advocating to make things more precise nor saying your math is
> flawed.  I'd prefer simpler code for things like this --- after all, my
> understanding of this whole exercise is to give "this is more or less the
> number you should expect" ballpack figure and nothing more (correct me if
> that is not what you are aiming for).

Yes, that's what I am aiming for. And I thought that my first patch was 
quite good at doing that, so when you said that "at the very low end the 
estimate is a bit too optimistic", I had another look and found out that 
for "all == 3" indeed the algorithm gave 0 when 1 was better, because 1 
should happen on average 2 times out of 3.

So I came up with the algorithm in v2 which is better because it should 
always give the best estimate (supposing 1) and 2)). It's also not much 
more complex compared to v1 or anything based on log2(all), so I don't see 
any reason to use something else.

Regards,
Christian.

      reply	other threads:[~2009-02-21 17:15 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-21  8:26 [PATCH v2.1 resend] rev-list: estimate number of bisection step left Christian Couder
2009-02-21  9:27 ` Junio C Hamano
2009-02-21 17:12   ` Christian Couder [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=200902211812.56593.chriscool@tuxfamily.org \
    --to=chriscool@tuxfamily.org \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=johnflux@gmail.com \
    --cc=mingo@elte.hu \
    --cc=trast@student.ethz.ch \
    /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).