* Feature request: don't require both bad and good when bisecting
@ 2012-03-18 21:29 darxus
2012-03-19 14:45 ` Andreas Ericsson
0 siblings, 1 reply; 6+ messages in thread
From: darxus @ 2012-03-18 21:29 UTC (permalink / raw)
To: git
I'd like to be able to tell get only that I know the latest commit is bad,
and have it go find a good commit, then do the bisecting. Maybe something
like the opposite of a binary search, start with the last commit, then
second to last, then 4th to last, 8th to last, etc., till it finds a good
commit.
--
"This hurts quite a bit. Very painful."
"Think of the sensation as reassurance that you are not dead yet. What
you are feeling is life in you!" - Johnny The Homicidal Maniac
http://www.ChaosReigns.com
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Feature request: don't require both bad and good when bisecting
2012-03-18 21:29 Feature request: don't require both bad and good when bisecting darxus
@ 2012-03-19 14:45 ` Andreas Ericsson
2012-03-19 15:30 ` Jeff King
0 siblings, 1 reply; 6+ messages in thread
From: Andreas Ericsson @ 2012-03-19 14:45 UTC (permalink / raw)
To: darxus; +Cc: git
On 03/18/2012 10:29 PM, darxus@chaosreigns.com wrote:
> I'd like to be able to tell get only that I know the latest commit is bad,
> and have it go find a good commit, then do the bisecting. Maybe something
> like the opposite of a binary search, start with the last commit, then
> second to last, then 4th to last, 8th to last, etc., till it finds a good
> commit.
>
Assuming the good commit is the 13'th from HEAD, you'd get the same nr
of attempts by just specifying a commit 100 revisions in the past and
doing the already implemented binary search as you would from trying 4
commits at a time to get at the good one.
Binary search is a "divide and conquer" algorithm (running in O(log n)
time), so it handles extremely large datasets very efficiently. As such,
it's (almost) always easier to just specify a revision really far back
in history and let it get to work. If you specify a range of 1000000
commits, it will take 20 attempts to find the right one ("git bisect"
has to exclude all possible candidates for both sides, so it always
runs in worst-case time, even when it hits the correct commit on the
first check).
--
Andreas Ericsson andreas.ericsson@op5.se
OP5 AB www.op5.se
Tel: +46 8-230225 Fax: +46 8-230231
Considering the successes of the wars on alcohol, poverty, drugs and
terror, I think we should give some serious thought to declaring war
on peace.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Feature request: don't require both bad and good when bisecting
2012-03-19 14:45 ` Andreas Ericsson
@ 2012-03-19 15:30 ` Jeff King
2012-03-19 16:24 ` Andreas Ericsson
0 siblings, 1 reply; 6+ messages in thread
From: Jeff King @ 2012-03-19 15:30 UTC (permalink / raw)
To: Andreas Ericsson; +Cc: darxus, git
On Mon, Mar 19, 2012 at 03:45:31PM +0100, Andreas Ericsson wrote:
> On 03/18/2012 10:29 PM, darxus@chaosreigns.com wrote:
> > I'd like to be able to tell get only that I know the latest commit is bad,
> > and have it go find a good commit, then do the bisecting. Maybe something
> > like the opposite of a binary search, start with the last commit, then
> > second to last, then 4th to last, 8th to last, etc., till it finds a good
> > commit.
> >
>
> Assuming the good commit is the 13'th from HEAD, you'd get the same nr
> of attempts by just specifying a commit 100 revisions in the past and
> doing the already implemented binary search as you would from trying 4
> commits at a time to get at the good one.
>
> Binary search is a "divide and conquer" algorithm (running in O(log n)
> time), so it handles extremely large datasets very efficiently.
Yeah. The OP's suggestion is to search backwards, increasing the stride
exponentially. That would end up finding a good commit in O(lg n),
though not with any great accuracy (e.g., for an old bug, you'd end up
considering the whole first half of history as a single stride). Since
bisection would then narrow the result in O(lg n), I think
asymptotically you are not any better off than you would be just
arbitrarily checking the root commit[1], and then starting the bisection
from there.
But both schemes run into a problem where old commits are often not very
testable. For example, when I am bisecting in git.git, I will run into
something like this:
1. Some feature is introduced in v1.7.0.
2. A bug in the feature is introduced in v1.7.2.
3. Somebody notices and reports the bug in v1.7.5.
There is no point in testing anything prior to v1.7.0, as your test
cannot succeed before the feature existed. And worse, it will actively
break a bisection. Pre-v1.7.0 versions will appear buggy, but it is in
fact a _different_ bug than the one you are searching for (the bug is
that the feature isn't there yet). This has been discussed many times on
the list, but the short of it is that you will not get sensible
bisection results if you have multiple bugs (or a bug that comes and
goes throughout history).
So bisect really needs some input from the user to find a sensible
boundary. And finding that boundary (if the user doesn't already know
it) is generally a manual thing. Because it is usually easy for a human
to recognize that the failure mode for points (1) and points (3) above
are different, but hard to write a script that correctly tests for it.
IOW, my procedure for a bug like the above is usually to walk backwards
along major tagged versions, manually interpreting the results. When I
try v1.6.0 and my test blows up (because the feature isn't implemented),
I recognize it, dig a little with "git log" to find where it was
implemented, and only then write a script for automated bisection.
-Peff
[1] There can also be multiple roots, which makes a backwards-walking
algorithm much more complex. I think instead you could simply test
and mark all the roots, and then start the bisection from there. But
again, you are unlikely to have written a test script that will work
on such antique versions of the project.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Feature request: don't require both bad and good when bisecting
2012-03-19 15:30 ` Jeff King
@ 2012-03-19 16:24 ` Andreas Ericsson
2012-03-19 16:45 ` Jeff King
2012-03-19 16:49 ` Junio C Hamano
0 siblings, 2 replies; 6+ messages in thread
From: Andreas Ericsson @ 2012-03-19 16:24 UTC (permalink / raw)
To: Jeff King; +Cc: darxus, git
On 03/19/2012 04:30 PM, Jeff King wrote:
> On Mon, Mar 19, 2012 at 03:45:31PM +0100, Andreas Ericsson wrote:
>
>> On 03/18/2012 10:29 PM, darxus@chaosreigns.com wrote:
>>> I'd like to be able to tell get only that I know the latest commit is bad,
>>> and have it go find a good commit, then do the bisecting. Maybe something
>>> like the opposite of a binary search, start with the last commit, then
>>> second to last, then 4th to last, 8th to last, etc., till it finds a good
>>> commit.
>>>
>>
>> Assuming the good commit is the 13'th from HEAD, you'd get the same nr
>> of attempts by just specifying a commit 100 revisions in the past and
>> doing the already implemented binary search as you would from trying 4
>> commits at a time to get at the good one.
>>
>> Binary search is a "divide and conquer" algorithm (running in O(log n)
>> time), so it handles extremely large datasets very efficiently.
>
> Yeah. The OP's suggestion is to search backwards, increasing the stride
> exponentially. That would end up finding a good commit in O(lg n),
> though not with any great accuracy (e.g., for an old bug, you'd end up
> considering the whole first half of history as a single stride). Since
> bisection would then narrow the result in O(lg n), I think
> asymptotically you are not any better off than you would be just
> arbitrarily checking the root commit[1], and then starting the bisection
> from there.
>
> But both schemes run into a problem where old commits are often not very
> testable. For example, when I am bisecting in git.git, I will run into
> something like this:
>
> 1. Some feature is introduced in v1.7.0.
>
> 2. A bug in the feature is introduced in v1.7.2.
>
> 3. Somebody notices and reports the bug in v1.7.5.
>
> There is no point in testing anything prior to v1.7.0, as your test
> cannot succeed before the feature existed. And worse, it will actively
> break a bisection.
Not "break", as such, but it's naturally left to the user to discover
when the feature the bug is in existed. Usually, that leaves a short-ish
window.
It's sort of beside the point though. Using git as experiment (again),
we're looking at less than 30000 revisions and 289 non-rc tags. With only
30k revisions, you'll do *worse* testing 15 tags sequentially than you
would by just letting the bisection machinery get on with it and use
the full history as base for bisection.
Ofcourse, if the project is large (as in "huge tree"), checking out
each version will become increasingly expensive the further apart
each version is, but the time it takes us to diminish the scope is
generally a lot quicker than the time it takes me to remember which
tag is next to try and then type the command to check it out, so
over-all, I've found it much more convenient to just give a range
I know is sufficiently large and then bisecting manually until I
get in the ballpark of the right range.
Automatic bisection is a different beast, naturally, since writing
a test-script that handles all corner cases (feature not added,
feature added but different bug found, feature added and right bug
found, etc) can be cumbersome, but that doesn't always apply, and
darxus didn't mention it. He only mentioned "let's test 4 revisions
back in history so I can find the good commit!", and I pointed out
that it's ridiculous to do so regardless of whether one has a hunch
of where the breakage is or not, since it will (almost) always be
100 times faster to just double the scanned range and let git get
on with it, even if it means doing a manual bisect first to find
when the feature was introduced and then an automated one to find
when the bug came alive.
> Pre-v1.7.0 versions will appear buggy, but it is in
> fact a _different_ bug than the one you are searching for (the bug is
> that the feature isn't there yet). This has been discussed many times on
> the list, but the short of it is that you will not get sensible
> bisection results if you have multiple bugs (or a bug that comes and
> goes throughout history).
>
> So bisect really needs some input from the user to find a sensible
> boundary. And finding that boundary (if the user doesn't already know
> it) is generally a manual thing. Because it is usually easy for a human
> to recognize that the failure mode for points (1) and points (3) above
> are different, but hard to write a script that correctly tests for it.
>
> IOW, my procedure for a bug like the above is usually to walk backwards
> along major tagged versions, manually interpreting the results. When I
> try v1.6.0 and my test blows up (because the feature isn't implemented),
> I recognize it, dig a little with "git log" to find where it was
> implemented, and only then write a script for automated bisection.
>
That means you've tested 81 tags (discarding rc tags between 1.7.6 and
1.6.0). Compared to binary search, that would correspond to a history
holding 1208925819614629174706176 revisions. Discarding maint releases,
we're down to 14 tags, and you gain (at most) one search on bisection
at the expense of more typing. Truly a toss-up.
What I was getting at is that trying to be more efficient than O(log n)
is hard and usually requires a really good educated guess to succeed.
Picking a random number of jumps to go backwards certainly isn't the
right way to do it, and especially since the problems you mentioned
(feature missing) will still exist with such a solution.
I managed to use a lot of text to get to that final paragraph. Sorry.
--
Andreas Ericsson andreas.ericsson@op5.se
OP5 AB www.op5.se
Tel: +46 8-230225 Fax: +46 8-230231
Considering the successes of the wars on alcohol, poverty, drugs and
terror, I think we should give some serious thought to declaring war
on peace.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Feature request: don't require both bad and good when bisecting
2012-03-19 16:24 ` Andreas Ericsson
@ 2012-03-19 16:45 ` Jeff King
2012-03-19 16:49 ` Junio C Hamano
1 sibling, 0 replies; 6+ messages in thread
From: Jeff King @ 2012-03-19 16:45 UTC (permalink / raw)
To: Andreas Ericsson; +Cc: darxus, git
On Mon, Mar 19, 2012 at 05:24:51PM +0100, Andreas Ericsson wrote:
> >> On 03/18/2012 10:29 PM, darxus@chaosreigns.com wrote:
> >>> I'd like to be able to tell get only that I know the latest commit is bad,
> >>> and have it go find a good commit, then do the bisecting. Maybe something
> >>> like the opposite of a binary search, start with the last commit, then
> >>> second to last, then 4th to last, 8th to last, etc., till it finds a good
> >>> commit.
> [...]
> Automatic bisection is a different beast, naturally, since writing
> a test-script that handles all corner cases (feature not added,
> feature added but different bug found, feature added and right bug
> found, etc) can be cumbersome, but that doesn't always apply, and
> darxus didn't mention it. He only mentioned "let's test 4 revisions
> back in history so I can find the good commit!", and I pointed out
> that it's ridiculous to do so regardless of whether one has a hunch
> of where the breakage is or not, since it will (almost) always be
> 100 times faster to just double the scanned range and let git get
> on with it, even if it means doing a manual bisect first to find
> when the feature was introduced and then an automated one to find
> when the bug came alive.
Hmm. What he wrote is confusing, since he uses "last" to refer to the
last commit, which would give strides of 2, 2, and then 4. Which makes
little sense to me. I took it to mean "2nd from the last tested, then
4th from the last tested, then 8th from the last tested". I.e., doubling
the stride each time.
If you take it to mean a fixed-size stride (e.g., maxing out at going
back 4 commits each time), then yes, that is absolutely horrible and
will do hundreds of times more work. I took it to mean exponential,
which has OK asymptotic behavior, but IMHO is _still_ not worth it.
> > IOW, my procedure for a bug like the above is usually to walk backwards
> > along major tagged versions, manually interpreting the results. When I
> > try v1.6.0 and my test blows up (because the feature isn't implemented),
> > I recognize it, dig a little with "git log" to find where it was
> > implemented, and only then write a script for automated bisection.
>
> That means you've tested 81 tags (discarding rc tags between 1.7.6 and
> 1.6.0).
Actually, I would usually try v1.7.0, then v1.6.0, and so on, depending
on the bug (and then possibly look at minor versions manually). But my
main point was that I am using some domain-specific knowledge about what
constitutes a good break-point when features might have been added, or
how far back is "reasonable". For some projects and some features, v0.99
might be a reasonable place to look. For git, it is generally not, and
anything before v1.5.0 is not even worth bisecting.
> What I was getting at is that trying to be more efficient than O(log n)
> is hard and usually requires a really good educated guess to succeed.
> Picking a random number of jumps to go backwards certainly isn't the
> right way to do it, and especially since the problems you mentioned
> (feature missing) will still exist with such a solution.
Oh, absolutely. I should have been more clear in my email: I was
agreeing with you that the OP's plan was not a good one. My goal wasn't
to do better than O(log n), but to eliminate the need for the user to
worry about picking bisection boundaries in the first place.
That is, in theory, you could have something like this:
git bisect start-run test.sh
which would test HEAD (which generally has the bug, or why are you
bisecting?), as well as all of the roots (which generally don't,
otherwise there is nothing to bisect). And it isn't much more work to
bisect because of the logarithmic nature of bisection (e.g., even if you
include 10 times as many commits, that's only ~3 extra bisection steps).
However, in practice that does not work because writing a test script to
handle antique code-bases automatically is at least as much work as just
finding a reasonable bisection boundary in the first place.
> I managed to use a lot of text to get to that final paragraph. Sorry.
That's OK. I read fast, and I may be guilty of verbosity from time to
time, as well. :)
-Peff
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Feature request: don't require both bad and good when bisecting
2012-03-19 16:24 ` Andreas Ericsson
2012-03-19 16:45 ` Jeff King
@ 2012-03-19 16:49 ` Junio C Hamano
1 sibling, 0 replies; 6+ messages in thread
From: Junio C Hamano @ 2012-03-19 16:49 UTC (permalink / raw)
To: Andreas Ericsson; +Cc: Jeff King, darxus, git
Andreas Ericsson <ae@op5.se> writes:
> It's sort of beside the point though. Using git as experiment (again),
> we're looking at less than 30000 revisions and 289 non-rc tags. With only
> 30k revisions, you'll do *worse* testing 15 tags sequentially than you
> would by just letting the bisection machinery get on with it and use
> the full history as base for bisection.
I think you are missing the primary point in what Jeff said.
It does not matter if you inspect increasingly older versions based on
exponentially longer strides or if you test tagged releases. What matters
is to making intelligent determination after seeing a failure, between the
failure due to "the feature being tested did not even exist" and "the
feature when introduced was good but at this commit it is broken".
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2012-03-19 16:49 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-18 21:29 Feature request: don't require both bad and good when bisecting darxus
2012-03-19 14:45 ` Andreas Ericsson
2012-03-19 15:30 ` Jeff King
2012-03-19 16:24 ` Andreas Ericsson
2012-03-19 16:45 ` Jeff King
2012-03-19 16:49 ` Junio C Hamano
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.