[ZODB-Dev] Checking the length of OOBTree

Laurence Rowe l at lrowe.co.uk
Thu Apr 8 11:41:04 EDT 2010


A BTree does not keep track of it's length. See BTrees.Length.Length:

http://apidoc.zope.org/++apidoc++/Code/BTrees/Length/Length/index.html

Laurence

On 8 April 2010 16:36, Leszek Syroka <leszek.marek.syroka at cern.ch> 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
>


More information about the ZODB-Dev mailing list