Rev 2479: Implement explicit handling of the no-cache version, which is even faster. in http://bzr.arbash-meinel.com/branches/bzr/0.17-dev/dirstate_pyrex
John Arbash Meinel
john at arbash-meinel.com
Fri May 4 00:41:37 BST 2007
At http://bzr.arbash-meinel.com/branches/bzr/0.17-dev/dirstate_pyrex
------------------------------------------------------------
revno: 2479
revision-id: john at arbash-meinel.com-20070503234105-xwv4fcxn26d97d6u
parent: john at arbash-meinel.com-20070503233549-445n015iomhc8ppm
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: dirstate_pyrex
timestamp: Thu 2007-05-03 18:41:05 -0500
message:
Implement explicit handling of the no-cache version, which is even faster.
modified:
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-03 23:35:49 +0000
+++ b/bzrlib/compiled/dirstate_helpers.pyx 2007-05-03 23:41:05 +0000
@@ -52,7 +52,25 @@
return value
-def bisect_dirblock(dirblocks, dirname, lo=0, hi=None, cache={}):
+cdef int _bisect_dirblock_nocache(object dirblocks, object dirname, int _lo, int _hi):
+ cdef int _mid
+ cdef object cur
+ cdef object cur_split
+ cdef object dirname_split
+
+ dirname_split = dirname.split('/')
+
+ while _lo < _hi:
+ _mid = (_lo+_hi)/2
+ # Grab the dirname for the current dirblock
+ cur = PyTuple_GetItem(PyList_GetItem(dirblocks, _mid), 0)
+ cur_split = cur.split('/')
+ if cur_split < dirname_split: _lo = _mid+1
+ else: _hi = _mid
+ return _lo
+
+
+def bisect_dirblock(dirblocks, dirname, lo=0, hi=None, cache=None):
"""Return the index where to insert dirname into the dirblocks.
The return value idx is such that all directories blocks in dirblock[:idx]
@@ -74,6 +92,9 @@
_hi = hi
_lo = lo
+ if cache is None:
+ return _bisect_dirblock_nocache(dirblocks, dirname, _lo, _hi)
+
dirname_split = _split_from_path(cache, dirname)
while _lo < _hi:
_mid = (_lo+_hi)/2
More information about the bazaar-commits
mailing list