[ZODB-Dev] PersistentMapping good for large numbers of objects?

Tim Peters tim at zope.com
Fri Jul 18 16:42:02 EDT 2003


[Dieter Maurer]
> Just out of curiosity:
>
>   Why does the lazy iterator need the rightmost bucket?
>
>   It could start with the leftmost one and iterate from there
>   over the leaves until it reaches the last one...

The last one what?  "The last bucket in the tree" isn't a correct answer in
general, because the iterator constructor takes optional min and max
arguments.  The iterator object then starts its life with two internal
pairs:  bucket pointer and bucket offset of the first object in the range,
and likewise for the last object in the range.  It's really only the case
where the max argument isn't given that bucket rightmost pointers are
followed to find the last bucket.  More generally two tree searches are done
at the start to find the first and last buckets.  Special cases omit one or
both searches depending on whether one or both of {min, max} aren't
specified.  The iterator object has a common structure regardless of which
arguments were given to the constructor.




More information about the ZODB-Dev mailing list