[Zope-Checkins] SVN: Zope/branches/2.11/ Launchpad #348223: optimize catalog query by breaking out early from loop
Tres Seaver
tseaver at palladion.com
Tue Mar 24 20:28:22 EDT 2009
Log message for revision 98340:
Launchpad #348223: optimize catalog query by breaking out early from loop
over indexes if the result set is already empty.
Changed:
U Zope/branches/2.11/doc/CHANGES.txt
U Zope/branches/2.11/lib/python/Products/ZCatalog/Catalog.py
-=-
Modified: Zope/branches/2.11/doc/CHANGES.txt
===================================================================
--- Zope/branches/2.11/doc/CHANGES.txt 2009-03-25 00:23:05 UTC (rev 98339)
+++ Zope/branches/2.11/doc/CHANGES.txt 2009-03-25 00:28:22 UTC (rev 98340)
@@ -27,6 +27,9 @@
Bugs Fixed
+ - Launchpad #348223: optimize catalog query by breaking out early from
+ loop over indexes if the result set is already empty.
+
- "Permission tab": correct wrong form parameter for
the user-permission report
Modified: Zope/branches/2.11/lib/python/Products/ZCatalog/Catalog.py
===================================================================
--- Zope/branches/2.11/lib/python/Products/ZCatalog/Catalog.py 2009-03-25 00:23:05 UTC (rev 98339)
+++ Zope/branches/2.11/lib/python/Products/ZCatalog/Catalog.py 2009-03-25 00:28:22 UTC (rev 98340)
@@ -1,3 +1,4 @@
+
##############################################################################
#
# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
@@ -478,7 +479,9 @@
if r is not None:
r, u = r
w, rs = weightedIntersection(rs, r)
-
+ if not rs:
+ break
+
if rs is None:
# None of the indexes found anything to do with the request
# We take this to mean that the query was empty (an empty filter)
More information about the Zope-Checkins
mailing list