Re: [ZODB-Dev] Checking the length of OOBTree

2010-04-10 Thread Chris McDonough
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@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
___
For more information about ZODB, see the ZODB Wiki:
http://www.zope.org/Wikis/ZODB/

ZODB-Dev mailing list  -  ZODB-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zodb-dev


Re: [ZODB-Dev] Checking the length of OOBTree

2010-04-08 Thread Laurence Rowe
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.syr...@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-...@zope.org
 https://mail.zope.org/mailman/listinfo/zodb-dev

___
For more information about ZODB, see the ZODB Wiki:
http://www.zope.org/Wikis/ZODB/

ZODB-Dev mailing list  -  ZODB-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zodb-dev


Re: [ZODB-Dev] Checking the length of OOBTree

2010-04-08 Thread Adam GROSZER
Hello,

And have a look at
http://svn.zope.org/zope.container/trunk/src/zope/container/btree.py?rev=107468view=markup
for usage.

self.__len = Length()

Thursday, April 8, 2010, 5:41:04 PM, you wrote:

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

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

LR Laurence

LR On 8 April 2010 16:36, Leszek Syroka
LR leszek.marek.syr...@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-...@zope.org
 https://mail.zope.org/mailman/listinfo/zodb-dev

LR ___
LR For more information about ZODB, see the ZODB Wiki:
LR http://www.zope.org/Wikis/ZODB/

LR ZODB-Dev mailing list  -  ZODB-Dev@zope.org
LR https://mail.zope.org/mailman/listinfo/zodb-dev


-- 
Best regards,
 Adam GROSZERmailto:agros...@gmail.com
--
Quote of the day:
The journey of a thousand miles begins with one step.  -  Lao-Tsze

___
For more information about ZODB, see the ZODB Wiki:
http://www.zope.org/Wikis/ZODB/

ZODB-Dev mailing list  -  ZODB-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zodb-dev