Rev 3664: Flattened all the way down the stack. in http://bzr.arbash-meinel.com/branches/bzr/1.7-dev/btree

John Arbash Meinel john at arbash-meinel.com
Thu Aug 21 22:37:51 BST 2008


At http://bzr.arbash-meinel.com/branches/bzr/1.7-dev/btree

------------------------------------------------------------
revno: 3664
revision-id: john at arbash-meinel.com-20080821213749-uoi9fiyg0aiea9sn
parent: john at arbash-meinel.com-20080821213603-wkxu0as290eh2q1a
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: btree
timestamp: Thu 2008-08-21 16:37:49 -0500
message:
  Flattened all the way down the stack.
  Next might be to try using something other than plain iteration.
  Like using PySequenceFast or some variant thereof.
modified:
  bzrlib/_parse_btree_c.pyx      _parse_btree_c.pyx-20080703034413-3q25bklkenti3p8p-2
-------------- next part --------------
=== modified file 'bzrlib/_parse_btree_c.pyx'
--- a/bzrlib/_parse_btree_c.pyx	2008-08-21 21:36:03 +0000
+++ b/bzrlib/_parse_btree_c.pyx	2008-08-21 21:37:49 +0000
@@ -264,7 +264,7 @@
     cdef Py_ssize_t next_len
     cdef int first_ref_list
     cdef int first_reference
-    cdef int first_key
+    cdef int first_bit
 
     # I don't expect that we can do faster than string.join()
     string_key = '\x00'.join(node[1])
@@ -330,10 +330,15 @@
                     out[0] = c'\r'
                     out = out + 1
                 first_reference = 0
-                flat_reference = '\x00'.join(reference)
-                next_len = PyString_Size(flat_reference)
-                memcpy(out, PyString_AsString(flat_reference), next_len)
-                out = out + next_len
+                first_bit = 1
+                for bit in reference:
+                    if first_bit == 0:
+                        out[0] = c'\x00'
+                        out = out + 1
+                    first_bit = 0
+                    next_len = PyString_Size(bit)
+                    memcpy(out, PyString_AsString(bit), next_len)
+                    out = out + next_len
     out[0] = c'\0'
     out = out  + 1
     memcpy(out, value, value_len)



More information about the bazaar-commits mailing list