I have very large BTreeFolder2 (CMFMember via BaseBTreeFolder in Archetypes)
- has about 260k items in _tree - objectIds() is painfully slow, as is
self._tree.keys() - I've casually observed using the meta type index to get
the object ids is many orders of magnitude faster.

Hacking objectIds() as follows (diff against trunk pasted inline) - gettting
ids off of the meta type index for all used meta types - seems to make
things much quicker.  Two questions:

1. Can this be considered safe in all cases (I'll code this behavior on a
Subclass or in a monkey patch)?

2. If yes to #1, is there an appropriate place to lobby for this to be
changed, perhaps in BTreeFolder2 product itself?



Index: BTreeFolder2.py
===================================================================
--- BTreeFolder2.py     (revision 41285)
+++ BTreeFolder2.py     (working copy)
@@ -341,10 +341,14 @@
         # Returns a list of subobject ids of the current object.
         # If 'spec' is specified, returns objects whose meta_type
         # matches 'spec'.
+
+        mti = self._mt_index
+        if spec is None:
+            spec = mti.keys()
+
         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)

Thanks,
Sean

+----------------------------------------------------------+
 Sean Upton                              SignOnSanDiego.com
 Site Technology Supervisor     The San Diego Union-Tribune
 619.718.5241                 [EMAIL PROTECTED]
 350 Camino De La Reina                 San Diego, CA 92108

  Plone Powered!  plone.org  ++  python.org  ++  zope.org  
+----------------------------------------------------------+ 

_______________________________________________
Zope-Dev maillist  -  Zope-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope )

Reply via email to