Rev 4436: We had an 'child_node.gdfo is None' check in the inner loop. in http://bazaar.launchpad.net/~jameinel/bzr/jam-gdfo-heads

John Arbash Meinel john at arbash-meinel.com
Fri Jun 19 20:37:15 BST 2009


At http://bazaar.launchpad.net/~jameinel/bzr/jam-gdfo-heads

------------------------------------------------------------
revno: 4436
revision-id: john at arbash-meinel.com-20090619193650-mfz7c42s0s8c33sr
parent: john at arbash-meinel.com-20090619192632-1a4ntoq61fkhlp2x
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: jam-gdfo-heads
timestamp: Fri 2009-06-19 14:36:50 -0500
message:
  We had an 'child_node.gdfo is None' check in the inner loop.
  This caused us to create a PyInt when we have a long which *can't* ever be None.
  
  Speeds up OOo a little bit, bzr is 54.5ms from ~69ms.
-------------- next part --------------
=== modified file 'bzrlib/_known_graph_pyx.pyx'
--- a/bzrlib/_known_graph_pyx.pyx	2009-06-19 19:13:37 +0000
+++ b/bzrlib/_known_graph_pyx.pyx	2009-06-19 19:36:50 +0000
@@ -221,6 +221,7 @@
         cdef int replace
         cdef Py_ssize_t pending_size
         cdef long known_gdfo
+        cdef long next_gdfo
 
         pending = []
         # Setting this as an attribute of _KnownGraphNode drops 774ms => 621ms,
@@ -238,6 +239,7 @@
             # timing shows this is 930ms => 770ms for OOo
             node = _get_list_node(pending, pending_size - 1)
             replace = 1
+            next_gdfo = node.gdfo + 1
             for child_pos from 0 <= child_pos < PyList_GET_SIZE(node.children):
                 child = _get_list_node(node.children, child_pos)
                 temp = PyDict_GetItem(known_parent_gdfos, child.key)
@@ -246,8 +248,8 @@
                 else:
                     known_gdfo = <object>temp
                     known_gdfo = known_gdfo + 1
-                if child.gdfo is None or node.gdfo + 1 > child.gdfo:
-                    child.gdfo = node.gdfo + 1
+                if next_gdfo > child.gdfo:
+                    child.gdfo = next_gdfo
                 if known_gdfo == PyTuple_GET_SIZE(child.parents):
                     # This child is populated, queue it to be walked
                     if replace:



More information about the bazaar-commits mailing list