~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/_known_graph_py.py

  • Committer: Vincent Ladeuil
  • Date: 2009-06-18 09:51:38 UTC
  • mto: This revision was merged to the branch mainline in revision 4466.
  • Revision ID: v.ladeuil+lp@free.fr-20090618095138-rha25usmqwsfwoxv
Simple Pyrex version for the new heads() method.

* tools/time_graph.py: 
Also display parent_map loading.

* bzrlib/_known_graph_pyx.pyx:
(KnownGraph.heads): pyrex version faster by ~20% than the previous
pyrex version, without using linears dominators. Strictly speaking
linear dominators breaks the algorithm as jumping from one node to
its dominator may miss a candidate. Trying to compensate that
seems to cost more than the benefits it provides :-/ Their use
will surely come back later.

Show diffs side-by-side

added added

removed removed

Lines of Context:
273
273
        pending = []
274
274
        min_gdfo = None
275
275
        for node in candidate_nodes.values():
276
 
            if node.parent_keys: # protect against ghosts, jam, fixme ?
 
276
            if node.parent_keys:
277
277
                pending.extend(node.parent_keys)
278
278
            if min_gdfo is None or node.gdfo < min_gdfo:
279
279
                min_gdfo = node.gdfo
287
287
            node = nodes[node_key]
288
288
            if node.gdfo <= min_gdfo:
289
289
                continue
290
 
            if node.parent_keys: # protect against ghosts, jam, fixme ?
 
290
            if node.parent_keys:
291
291
                pending.extend(node.parent_keys)
292
292
        heads = heads_key.difference(seen)
293
293
        if self.do_cache: