[Zope-Checkins] SVN: Zope/branches/andig-catalog-report/src/Products/ZCatalog/CatalogReport.py Avoid key calculation overhead for fast queries

Hanno Schlichting hannosch at hannosch.eu
Sat Jul 24 13:54:11 EDT 2010


Log message for revision 115040:
  Avoid key calculation overhead for fast queries
  

Changed:
  U   Zope/branches/andig-catalog-report/src/Products/ZCatalog/CatalogReport.py

-=-
Modified: Zope/branches/andig-catalog-report/src/Products/ZCatalog/CatalogReport.py
===================================================================
--- Zope/branches/andig-catalog-report/src/Products/ZCatalog/CatalogReport.py	2010-07-24 17:50:26 UTC (rev 115039)
+++ Zope/branches/andig-catalog-report/src/Products/ZCatalog/CatalogReport.py	2010-07-24 17:54:11 UTC (rev 115040)
@@ -187,13 +187,16 @@
         self.log()
 
     def log(self):
-        key = make_key(self.catalog, self.request)
-
         # result of stopwatch
         res = self.result()
         if res[0] < self.threshold:
             return
 
+        # The key calculation takes a bit itself, we want to avoid that for
+        # any fast queries. This does mean that slow queries get the key
+        # calculation overhead added to their runtime.
+        key = make_key(self.catalog, self.request)
+
         reports_lock.acquire()
         try:
             if self.cid not in reports:



More information about the Zope-Checkins mailing list