~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to tools/time_graph.py

  • Committer: John Arbash Meinel
  • Date: 2009-06-10 19:56:16 UTC
  • mto: (4371.4.5 vila-better-heads)
  • mto: This revision was merged to the branch mainline in revision 4449.
  • Revision ID: john@arbash-meinel.com-20090610195616-alggpr46n0bmjjhf
Get an initial pyrex implementation.

Initial results show it to actually be slightly slower than pure python.

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
import time
5
5
import sys
6
6
import optparse
7
 
from bzrlib import branch, commands, graph, ui, trace
 
7
from bzrlib import (
 
8
    branch,
 
9
    commands,
 
10
    graph,
 
11
    ui,
 
12
    trace,
 
13
    _known_graph_py,
 
14
    _known_graph_pyx,
 
15
    )
8
16
from bzrlib.ui import text
9
17
 
10
18
p = optparse.OptionParser()
58
66
 
59
67
print '      %d combinations' % (len(combinations),)
60
68
t1 = time.clock()
61
 
known_g = graph.KnownGraph(parent_map)
 
69
known_g = _known_graph_py.KnownGraph(parent_map)
62
70
if opts.lsprof is not None:
63
71
    h_known = commands.apply_lsprofiled(opts.lsprof,
64
72
        all_heads_comp, known_g, combinations)
67
75
t2 = time.clock()
68
76
print "Known: %.3fs" % (t2-t1,)
69
77
print "  %s" % (graph._counters,)
 
78
t1 = time.clock()
 
79
known_g = _known_graph_pyx.KnownGraph(parent_map)
 
80
if opts.lsprof is not None:
 
81
    h_known = commands.apply_lsprofiled(opts.lsprof,
 
82
        all_heads_comp, known_g, combinations)
 
83
else:
 
84
    h_known = all_heads_comp(known_g, combinations)
 
85
t2 = time.clock()
 
86
print "Known (pyx): %.3fs" % (t2-t1,)
 
87
print "  %s" % (graph._counters,)
70
88
simple_g = graph.Graph(graph.DictParentsProvider(parent_map))
71
89
graph._counters[1] = 0
72
90
graph._counters[2] = 0