[MERGE/RFC] A bit more info for 'lsprof' about index action
John Arbash Meinel
john at arbash-meinel.com
Thu Oct 2 23:16:15 BST 2008
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
This is a rather trivial patch that just introduces a couple of local
functions.
This is a little useful when trying to debug where the time goes during
index operations. All it really does is separate the time spent because
of "buffering because I read the whole file already" from "buffering
because I've read more than 1/2 the file, and I'm going to be reading
even more.".
We can decide to accept it or not. It has been a little bit of help, but
I think the future lies in BTreeIndex anyway.
John
=:->
=== modified file 'bzrlib/index.py'
- --- bzrlib/index.py 2008-09-21 14:48:37 +0000
+++ bzrlib/index.py 2008-10-02 22:14:23 +0000
@@ -1060,7 +1060,9 @@
if self._nodes is None and self._bytes_read * 2 >= self._size:
# We've already read more than 50% of the file and we are
about to
# request more data, just _buffer_all() and be done
- - self._buffer_all()
+ def too_much_data_read():
+ self._buffer_all()
+ too_much_data_read()
return
readv_data = self._transport.readv(self._name, readv_ranges, True,
@@ -1072,7 +1074,9 @@
# We read the whole range, most likely because the
# Transport upcast our readv ranges into one long request
# for enough total data to grab the whole index.
- - self._buffer_all(StringIO(data))
+ def readv_all_data():
+ self._buffer_all(StringIO(data))
+ readv_all_data()
return
if self._bisect_nodes is None:
# this must be the start
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iEYEARECAAYFAkjlSC8ACgkQJdeBCYSNAAM4JgCgieMEzh8+Fg9o1yrknjqjvOMF
ujUAnRmO7v1eAZoeEN0MWItKX7byDk20
=I8E+
-----END PGP SIGNATURE-----
More information about the bazaar
mailing list