[Grok-dev] Performance of OrderedContainer
Gary Poster
gary at zope.com
Tue Jun 17 13:58:36 EDT 2008
On Jun 17, 2008, at 6:05 AM, Sebastian Ware wrote:
> I was looking at the trunk of grok because I need to use
> OrderedContainer. But, if I add say 1 million objects to an
> OrderedContainer, won't it become very slow due to the
> implementation with PersistentList? Say that I want to show the last
> 100 of the objects, I would have to return all 1 million keys.
Big ordered mappings are one of the use cases for zc.blist. The
following is a description, including the mechanism.
http://svn.zope.org/zc.blist/trunk/src/zc/blist/README.txt?view=auto
The set of edge cases is very large, and so the tests are primarily of
the "run random operations for hours to try and find a problem". I've
run them for four or five hours now without any bugs. I intend to
release 1.0 soon, and some internal ZC projects will be using it soon.
It can be a drop in replacement for PersistentList in an ordered
mapping implementation. The only potential incompatibility I can
think of is that getting a slice returns an iterator rather than a list.
Gary
More information about the Grok-dev
mailing list