[ZODB-Dev] PersistentMapping good for large numbers of objects?
Steve Alexander
steve at z3u.com
Wed Jul 23 00:23:30 EDT 2003
> Heh. If we supply a canned object, people will take that (reasonably
> enough) as a claim that the canned object is suitable for all BTree
> purposes. That your particular app is happy to abide a grossly inefficient
> implementation of .update() doesn't help me when I get a bug report
> complaining that someone else's app isn't so tolerant.
>
> "someone who wants it enough is welcome to write it" is still my take on it,
> and if that someone decides to implement update inefficiently-- or not to
> implement update at all --they should document that up-front.
Another approach would be for BTrees to grow a callback for whenever a
new key is added and callback for whenever a new key is removed. Let's
not go there :-)
Yet another approach would be for BTrees to have a non-persistent
settable integer counter, and they could increment and decrement the
counter as keys are added or removed. A client could check this counter
to see how an independently stored length is supposed to be changed.
Here's what the method from the wrapper would look like:
def update(self, seq):
btree = self.__btree
btree.deltaLength = 0
btree.update(seq)
if btree.deltaLength:
self.__length += btree.deltaLength
I'm not suggesting anyone implement this, just offering up ideas.
--
Steve Alexander
More information about the ZODB-Dev
mailing list