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
David Binger
2005-07-14
On Jul 13, 2005, at 9:29 PM, Peter Fein wrote:

> 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.

Agreed.

> 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?

Yes.  The use-case would be large mappings that do not change
frequently,
but for which you frequently wish to know the size.  I think the size
should
be maintained, not on the BTree itself, but on a separate Persistent
instance held on an attribute of the BTree.  This will help avoid the
very
expensive invalidation of the BTree itself.

reply