durusmail: durus-users: Re: __len__ for Btrees was Re: [Durus-users] some btree enhancements
some btree enhancements
2005-07-13
2005-07-13
2005-07-13
2005-07-13
2005-07-13
Re: __len__ for Btrees was Re: [Durus-users] some btree enhancements
2005-07-14
2005-07-14
2005-07-14
2005-07-14
2005-07-14
2005-07-14
2005-09-09
Re: __len__ for Btrees was Re: [Durus-users] some btree enhancements
Peter Fein
2005-07-14
David Binger wrote:
> By the way, because of the way Persistent Instances work, calculating
> the size
> by iterating over the tree only causes the actual loading of the  BNodes
> of the
> BTree (a logarithmic function of the size).  The actual values in the
> BTree,
> if they are Persistent, are not forced by the iteration to load their
> state.

Ok, but this is a pretty large cost overhead compared to the constant
time len() of a PersistentDict or python dict.  If you need to do a lot
of len()'s, it adds up pretty quickly.

Though the increased ConflictErrors do seem problematic.  Would it make
sense to provide a subclass that supports this (LenBTree or some such)
for folks who want it?

--
Peter Fein                 pfein@pobox.com                 773-575-0694

Basically, if you're not a utopianist, you're a schmuck. -J. Feldman
reply