Rev 5532: Profiling says that even though _limit_hash_entries uses objects, in http://bazaar.launchpad.net/~jameinel/bzr/2.3-gcb-peak-mem
John Arbash Meinel
john at arbash-meinel.com
Tue Nov 23 18:58:54 GMT 2010
At http://bazaar.launchpad.net/~jameinel/bzr/2.3-gcb-peak-mem
------------------------------------------------------------
revno: 5532
revision-id: john at arbash-meinel.com-20101123185819-016sfnhqupjnat7p
parent: john at arbash-meinel.com-20101123184250-bwayj00cwd2r2q20
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: 2.3-gcb-peak-mem
timestamp: Tue 2010-11-23 12:58:19 -0600
message:
Profiling says that even though _limit_hash_entries uses objects,
we spend a total of only 33ms in that function, versus the rest of the time.
Doesn't look like something worth optimizing for yet.
-------------- next part --------------
=== modified file 'bzrlib/_delta_index_pyx.pyx'
--- a/bzrlib/_delta_index_pyx.pyx 2010-11-23 18:42:50 +0000
+++ b/bzrlib/_delta_index_pyx.pyx 2010-11-23 18:58:19 +0000
@@ -57,6 +57,7 @@
unsigned char *top) nogil
+cdef int MAX_HASH_BUCKET_ENTRIES
MAX_HASH_BUCKET_ENTRIES = 64
cdef int MAX_DELTA_OP_SIZE
# This is a copy instruction of 64kB at the largest possible offset, etc.
@@ -66,6 +67,16 @@
cdef int MAX_MATCH_TAIL
MAX_MATCH_TAIL = 65535
+import time
+cdef object _timer
+_timer = time.clock
+cdef double total_time
+total_time = 0.0
+
+import atexit, sys
+def report_total_time():
+ sys.stderr.write('spent %.3fs in _limit_hash_entries\n' % (total_time,))
+atexit.register(report_total_time)
cdef struct rabin_entry:
@@ -425,7 +436,10 @@
entry.global_offset = global_offset
self.entry_count += 1
if search.match_count + 1 >= MAX_HASH_BUCKET_ENTRIES:
+ global total_time
+ c = _timer()
self._limit_hash_entries(val, search)
+ total_time += <double>(_timer() - c)
return entry
def _py_add(self, val, global_offset, pre_bytes, post_bytes):
More information about the bazaar-commits
mailing list