git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jon Seymour <jon.seymour@gmail.com>
To: Linus Torvalds <torvalds@osdl.org>
Cc: Git Mailing List <git@vger.kernel.org>
Subject: Re: git-rev-list: "--bisect" flag
Date: Mon, 20 Jun 2005 13:27:21 +1000	[thread overview]
Message-ID: <2cfc403205061920272ee47166@mail.gmail.com> (raw)
In-Reply-To: <Pine.LNX.4.58.0506192002240.2268@ppc970.osdl.org>

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

I'll give you a sketch of the algorithm. 

First, recall that merge-order code uses an incremental topological
sort whose key idea is to employ a conservation of mass analogy. A
similar analogy can help here.

1. count all visible nodes [ i.e. nodes that git-rev-list would print
], call this value N
2. at the top node inject N units of mass
3. traverse the visible graph, in topological order
4. at each node, send all the mass received from parents minus 1 unit
onto visible parents. Record how much mass you have sent downstream.
Keep a record of the nodes that have seen nearest to half of that
mass.
5. when the traversal completes, choose the node that saw closest to
1/2 of the original mass [ or pick one at random if there is more than
one ]. It must be able to reach close to 1/2 of the visible graph,
'cos all that mass it has seen has to drain somewhere!

This algorithm is demonstrably O(V+E) because the traversal is O(V+E)

My intention is to add this algorithm to my refactored
epoch.c/traversal.c, since this is a much better framework for doing
traversals than the current epoch.c.

Do you have any objections to me doing that?

jon.
-- 
homepage: http://www.zeta.org.au/~jon/
blog: http://orwelliantremors.blogspot.com/

  reply	other threads:[~2005-06-20  3:21 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-06-18  6:31 git-rev-list: "--bisect" flag Linus Torvalds
2005-06-19  0:18 ` Jon Seymour
2005-06-19  3:38   ` Jan Harkes
2005-06-19  4:07     ` Jon Seymour
2005-06-19  3:43   ` Linus Torvalds
2005-06-19  5:03     ` Linus Torvalds
2005-06-19  5:05       ` David Lang
2005-06-19  5:30         ` Linus Torvalds
2005-06-19 10:15       ` Jon Seymour
2005-06-19 14:41         ` Jon Seymour
2005-06-19 17:20           ` Linus Torvalds
2005-06-19 17:36             ` Ingo Molnar
2005-06-19 19:01               ` Linus Torvalds
2005-06-19 19:55             ` Jon Seymour
2005-06-20  3:09               ` Linus Torvalds
2005-06-20  3:27                 ` Jon Seymour [this message]
2005-06-20  3:30                   ` Jon Seymour
2005-06-20 10:29                     ` Jon Seymour
2005-06-20 14:37                       ` Jon Seymour

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=2cfc403205061920272ee47166@mail.gmail.com \
    --to=jon.seymour@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=jon@blackcubes.dyndns.org \
    --cc=torvalds@osdl.org \
    /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).