Log message for revision 115353:
  Better benchmark initialization
  

Changed:
  U   Zope/trunk/src/Products/ZCatalog/plan.py

-=-
Modified: Zope/trunk/src/Products/ZCatalog/plan.py
===================================================================
--- Zope/trunk/src/Products/ZCatalog/plan.py    2010-08-01 20:43:56 UTC (rev 
115352)
+++ Zope/trunk/src/Products/ZCatalog/plan.py    2010-08-01 20:49:28 UTC (rev 
115353)
@@ -111,12 +111,12 @@
     """
 
     def __init__(self, catalog, query=None, threshold=0.1):
-        self.init_timer()
         self.catalog = catalog
         self.query = query
         self.key = make_key(catalog, query)
         self.threshold = threshold
         self.cid = self.get_id()
+        self.init_timer()
 
     def get_id(self):
         parent = aq_parent(self.catalog)
@@ -143,7 +143,10 @@
 
     def benchmark(self):
         # holds the benchmark of each index
-        return self.prioritymap().get(self.key, None)
+        bm = self.prioritymap().get(self.key, None)
+        if bm is None:
+            self.prioritymap()[self.key] = {}
+        return bm
 
     def plan(self):
         benchmark = self.benchmark()
@@ -158,9 +161,6 @@
     def start(self):
         self.init_timer()
         self.start_time = time.time()
-        benchmark = self.benchmark()
-        if benchmark is None:
-            self.prioritymap()[self.key] = {}
 
     def start_split(self, label, result=None):
         self.interim[label] = (time.time(), None)

_______________________________________________
Zope-Checkins maillist  -  Zope-Checkins@zope.org
https://mail.zope.org/mailman/listinfo/zope-checkins

Reply via email to