Rev 2527: Changing Reader.get_next_str (which returns a Python String) in

John Arbash Meinel john at
Mon May 7 23:11:29 BST 2007


revno: 2527
revision-id: john at
parent: john at
committer: John Arbash Meinel <john at>
branch nick: dirstate_pyrex
timestamp: Mon 2007-05-07 17:11:17 -0500
  Changing Reader.get_next_str (which returns a Python String)
  into a c function saves a lot of time.
  Specifically it avoids a GetAttr call, and a PyObject_CallObject
  This drops the times down to:
  ...test__read_dirblocks_20k_tree_0_parents_c    OK      122ms/    2561ms
  ...test__read_dirblocks_20k_tree_0_parents_py   OK      235ms/    2606ms
  ...test__read_dirblocks_20k_tree_1_parent_c     OK      175ms/    2797ms
  ...test__read_dirblocks_20k_tree_1_parent_py    OK      358ms/    3014ms
  ...test__read_dirblocks_20k_tree_2_parents_c    OK      259ms/    2992ms
  ...test__read_dirblocks_20k_tree_2_parents_py   OK      498ms/    3232ms
  We are close to being 2x faster than the python implementation.
  bzrlib/compiled/dirstate_helpers.pyx dirstate_helpers.pyx-20070503201057-u425eni465q4idwn-3
-------------- next part --------------
=== modified file 'bzrlib/compiled/dirstate_helpers.pyx'
--- a/bzrlib/compiled/dirstate_helpers.pyx	2007-05-07 20:38:16 +0000
+++ b/bzrlib/compiled/dirstate_helpers.pyx	2007-05-07 22:11:17 +0000
@@ -245,7 +245,7 @@
         self.cur = self.cur + 1
         return next
-    def get_next_str(self):
+    cdef object get_next_str(self):
         """Get the next field as a Python string."""
         cdef int size
         cdef char *next

More information about the bazaar-commits mailing list