[ZODB-Dev] Checking the length of OOBTree

Chris McDonough chrism at plope.com
Sat Apr 10 11:14:06 EDT 2010


I'm not sure about the internal "len" variable, but I usually maintain a 
separate length in something that uses a BTree by using a BTrees.Length.Length 
object:

http://svn.repoze.org/repoze.folder/trunk/repoze/folder/__init__.py

On 4/8/10 11:36 AM, Leszek Syroka wrote:
> Hi,
>
> what is the fastest way of checking the number of elements in OOBtree.
> Execution time of
>
> len( OOBtree.keys() ) and len(OOBtree)
>
> is exactly the same. For big data sets execution time is unacceptable. I
> found out that in the implementation of OOBtree (written in C) there is
> a variable called 'len', which seems to contain the length of the tree.
> Is it possible to access that variable from the python code without
> modifying the source?
>
> Best regards
> Leszek
> _______________________________________________
> For more information about ZODB, see the ZODB Wiki:
> http://www.zope.org/Wikis/ZODB/
>
> ZODB-Dev mailing list  -  ZODB-Dev at zope.org
> https://mail.zope.org/mailman/listinfo/zodb-dev
>


-- 
Chris McDonough
Agendaless Consulting, Fredericksburg VA
The repoze.bfg Web Application Framework Book: http://bfg.repoze.org/book


More information about the ZODB-Dev mailing list