Rev 4394: Using PySet_Add in the inner loop is a little better, not tremendously, though in http://bazaar.launchpad.net/~jameinel/bzr/1.16-better_heads

John Arbash Meinel john at arbash-meinel.com
Wed Jun 10 23:13:31 BST 2009


At http://bazaar.launchpad.net/~jameinel/bzr/1.16-better_heads

------------------------------------------------------------
revno: 4394
revision-id: john at arbash-meinel.com-20090610221322-uv24p5wlgtic7j13
parent: john at arbash-meinel.com-20090610220839-wmp8pe3qqra3weq6
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: 1.16-better_heads
timestamp: Wed 2009-06-10 17:13:22 -0500
message:
  Using PySet_Add in the inner loop is a little better, not tremendously, though
-------------- next part --------------
=== modified file 'bzrlib/_known_graph_pyx.pyx'
--- a/bzrlib/_known_graph_pyx.pyx	2009-06-10 22:08:39 +0000
+++ b/bzrlib/_known_graph_pyx.pyx	2009-06-10 22:13:22 +0000
@@ -28,6 +28,7 @@
     object PyFrozenSet_New(object)
     PyObject * PyDict_GetItem(object d, object k)
     int PyDict_SetItem(object d, object k, object v) except -1
+    int PySet_Add(object s, object k) except -1
     void Py_INCREF(object)
 
 
@@ -428,7 +429,8 @@
             # Rewrite using PySet_* functions, unfortunately you have to use
             # PySet_Add since there is no PySet_Update... :(
             all_ancestors = set(parent_node.ancestor_of)
-            all_ancestors.update(node.ancestor_of)
+            for k in node.ancestor_of:
+                PySet_Add(all_ancestors, k)
             parent_node.ancestor_of = tuple(sorted(all_ancestors))
         return 0
 



More information about the bazaar-commits mailing list