[ZPT] Re: re# IMPORTANT NOTE## Getting the length of a BTree, TreeSet,or output of keys,# values, or items of same is expensive. If you needto get the# length, you need to maintain this separately.#Pleasemake "total" lazy!

Chris Withers chrisw@nipltd.com
Fri, 15 Mar 2002 18:01:56 +0000


Steve Alexander wrote:
> 
> # IMPORTANT NOTE
> #
> # Getting the length of a BTree, TreeSet, or output of keys,
> # values, or items of same is expensive. If you need to get the
> # length, you need to maintain this separately.

But why would the length of a ZCatalog results set need to be calculated in this way?

cheers,

Chris

PS: If it does need to calculate it in this way, I think that's a bug in the BTrees
implementation. The users shouldn't have to care about how the length is stored or
computed, the BTrees internally should keep a seperate counter ifthat's what they need to
do, then it can be kept in synch in a much tigher loop..