Commit 37eb25f1 authored by Hanno Schlichting's avatar Hanno Schlichting

Move the len() calculation into the stop watch class

parent 6de4ee54
......@@ -528,14 +528,14 @@ class Catalog(Persistent, Acquisition.Implicit, ExtensionClass.Base):
# once we don't need to support the "return everything" case
# anymore
if r is not None and not r:
cr.split(i, 0)
cr.split(i, None)
return LazyCat([])
cr.split(i, len(r))
cr.split(i, r)
w, rs = weightedIntersection(rs, r)
if not rs:
break
else:
cr.split(i, 0)
cr.split(i, None)
cr.stop()
......
......@@ -117,7 +117,7 @@ class StopWatch(object):
self.init()
self.start_time = time.time()
def split(self, label, result_length=None):
def split(self, label, result=None):
current = time.time()
start_time, stop_time = self.interim.get(label, (None, None))
......@@ -125,8 +125,12 @@ class StopWatch(object):
self.interim[label] = (current, None)
return
length = 0
if result is not None:
# TODO: calculating the length can be expensive
length = len(result)
self.interim[label] = (start_time, current)
self.res.append((label, current - start_time, result_length))
self.res.append((label, current - start_time, length))
def stop(self):
self.end_time = time.time()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment