git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: git-rev-list: "--bisect" flag

From
Linus Torvalds <torvalds@osdl.org>
Date
Jun 20, 2005, 03:09 UTC
Message-ID
<Pine.LNX.4.58.0506192002240.2268@ppc970.osdl.org>
In-Reply-To
<2cfc4032050619125537dee354@mail.gmail.com>
On Mon, 20 Jun 2005, Jon Seymour wrote:
Show 8 quoted lines
>
> Yep, ok, so the node you are looking for is one that can reach as
> close to half of the rest of the graph as possible - that's what you
> mean by half-way reachability. If the graph was N nodes deep (no
> fan-out) that would be the literal middle. If it was N nodes wide
> (e.g. fanout N), there is no good node and you basically have to test
> everything since one test doesn't imply anything about the other N-1
> nodes.
Exactly.
> A typical commit graph is worse than O(log2 N) by a factor that is
> determined by some measure of the parallel branching in the graph.

Yes. In many cases it's ok to have parallellism, and the fact that any normal merges will always be two-way (ie there's never a commit in practice that has a very high fan-in), I do believe that you normally get pretty close to that O(log2N) behaviour. In fact, your numbers seemed to say that we're normally within 10% of it.

> I presume  you mean O(N^3)?
Yup again.
> Will you accept a patch that can reduce the worst case cost to some
> lower order? I have a hunch (conceivably wrong, of course) that it can
> be done in O(N).

Well, it depends on how nasty it ends up being. I thought my stupid algorithm would suck horribly, but considering that it can trivially bisect all of the git history so far in basically zero time, it doesn't seem to be that bad. You're more likely to have problems with having to bring in all the commits from disk in the cold-cache case than you are to have problems with the current algorithm performance.

Even at O(N^3) it shouldn't be too nasty even if some crazy person tried to bisect a years worth of development (which really isn't very reasonable behaviour anyway, it's just not sensible to not try a few standard releases in between first).

			Linus
Previous: Jon SeymourNext: Jon Seymour
Message 15 of 19 in “git-rev-list: "--bisect" flag”
  1. Linus TorvaldsJun 18, 2005
  2. Jon SeymourJun 19, 2005
  3. Jan HarkesJun 19, 2005
  4. Jon SeymourJun 19, 2005
  5. Linus TorvaldsJun 19, 2005
  6. Linus TorvaldsJun 19, 2005
  7. David LangJun 19, 2005
  8. Linus TorvaldsJun 19, 2005
  9. Jon SeymourJun 19, 2005
  10. Jon SeymourJun 19, 2005
  11. Linus TorvaldsJun 19, 2005
  12. Ingo MolnarJun 19, 2005
  13. Linus TorvaldsJun 19, 2005
  14. Jon SeymourJun 19, 2005
  15. Linus TorvaldsJun 20, 2005
  16. Jon SeymourJun 20, 2005
  17. Jon SeymourJun 20, 2005
  18. Jon SeymourJun 20, 2005
  19. Jon SeymourJun 20, 2005

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.