Rev 4634: small cleanup, a bit of comment tweaking. in http://bazaar.launchpad.net/~jameinel/bzr/1.19-known-graph-sorted
John Arbash Meinel
john at arbash-meinel.com
Mon Aug 17 18:23:18 BST 2009
At http://bazaar.launchpad.net/~jameinel/bzr/1.19-known-graph-sorted
------------------------------------------------------------
revno: 4634
revision-id: john at arbash-meinel.com-20090817172306-2w72juabo9wkj1vc
parent: john at arbash-meinel.com-20090817163507-0j9tdamcybwqu8rn
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: 1.19-known-graph-sorted
timestamp: Mon 2009-08-17 12:23:06 -0500
message:
small cleanup, a bit of comment tweaking.
-------------- next part --------------
=== modified file 'bzrlib/_known_graph_pyx.pyx'
--- a/bzrlib/_known_graph_pyx.pyx 2009-08-17 16:35:07 +0000
+++ b/bzrlib/_known_graph_pyx.pyx 2009-08-17 17:23:06 +0000
@@ -63,8 +63,6 @@
cdef object extra
def __init__(self, key):
- cdef int i
-
self.key = key
self.parents = None
@@ -192,11 +190,16 @@
parent_keys = <object>temp_parent_keys
num_parent_keys = len(parent_keys)
node = self._get_or_create_node(key)
- # We know how many parents, so we could pre allocate an exact sized
- # tuple here
+ # We know how many parents, so we pre allocate the tuple
parent_nodes = PyTuple_New(num_parent_keys)
- # We use iter here, because parent_keys maybe be a list or tuple
for pos2 from 0 <= pos2 < num_parent_keys:
+ # Note: it costs us 10ms out of 40ms to lookup all of these
+ # parents, it doesn't seem to be an allocation overhead,
+ # but rather a lookup overhead. There doesn't seem to be
+ # a way around it, and that is one reason why
+ # KnownGraphNode maintains a direct pointer to the parent
+ # node.
+ # We use [] because parent_keys may be a tuple or list
parent_node = self._get_or_create_node(parent_keys[pos2])
# PyTuple_SET_ITEM will steal a reference, so INCREF first
Py_INCREF(parent_node)
More information about the bazaar-commits
mailing list