The sequence in this package has a list-like API, but stores its values in individual
buckets. This means that, for small changes in large sequences, the sequence could be a
big win. For instance, an ordered BTree-based container might want to store order in a
sequence, so that moves only cause a bucket or two--around 50 strings or less--to be
rewritten in the database, rather than the entire contents (which might be thousands
of strings, for instance).
If the sequence is most often completely rearranged, the complexity of the code in this
package is not desirable. It only makes sense if changes most frequently are fairly small.
One downside is that reading and writing is more work than with a normal list. If this
were to actually gain traction, perhaps writing some or all of it in C would be helpful.
However, it still seems pretty snappy.
Another downside is the corollary of the bucket advantage listed initially: with more
persistent objects, iterating over it will fill a lot of ZODB's object cache (which is
based on the number of objects cached, rather than the size). Consider specifying a big
object cache if you are using these to store a lot of data and are frequently iterating
or changing.
These sequences return slices as iterators, and add some helpful iteration methods. It adds
a copy method that provides a cheap copy of the blist that shares all buckets and indexes
until a write happens, at which point it copies and mutates the affected indexes and buckets.
We'll take a glance at how these differences work, and then describe the implementation's
basic mechanism, and close with a brief discussion of performance characteristics in the
abstract.
|