[Zope-Checkins]
SVN: Zope/trunk/lib/python/Products/BTreeFolder2/BTreeFolder2.py
Sean Upton's optimization of BTreeFolder2.objectIds(). Should
speed up
Shane Hathaway
shane at zope.com
Mon Jan 23 23:57:23 EST 2006
Log message for revision 41421:
Sean Upton's optimization of BTreeFolder2.objectIds(). Should speed up
certain operations significantly.
Changed:
U Zope/trunk/lib/python/Products/BTreeFolder2/BTreeFolder2.py
-=-
Modified: Zope/trunk/lib/python/Products/BTreeFolder2/BTreeFolder2.py
===================================================================
--- Zope/trunk/lib/python/Products/BTreeFolder2/BTreeFolder2.py 2006-01-23 14:04:03 UTC (rev 41420)
+++ Zope/trunk/lib/python/Products/BTreeFolder2/BTreeFolder2.py 2006-01-24 04:57:23 UTC (rev 41421)
@@ -341,21 +341,22 @@
# Returns a list of subobject ids of the current object.
# If 'spec' is specified, returns objects whose meta_type
# matches 'spec'.
- if spec is not None:
- if isinstance(spec, StringType):
- spec = [spec]
- mti = self._mt_index
- set = None
- for meta_type in spec:
- ids = mti.get(meta_type, None)
- if ids is not None:
- set = union(set, ids)
- if set is None:
- return ()
- else:
- return set.keys()
+
+ mti = self._mt_index
+ if spec is None:
+ spec = mti.keys() #all meta types
+
+ if isinstance(spec, StringType):
+ spec = [spec]
+ set = None
+ for meta_type in spec:
+ ids = mti.get(meta_type, None)
+ if ids is not None:
+ set = union(set, ids)
+ if set is None:
+ return ()
else:
- return self._tree.keys()
+ return set.keys()
security.declareProtected(access_contents_information,
More information about the Zope-Checkins
mailing list