[ZODB-Dev] Ackward PersistentList read Performance

Malthe Borch mborch at gmail.com
Tue Aug 13 16:12:06 CEST 2013


On 13 August 2013 15:40, Joerg Baach <lists at baach.de> wrote:
> So, can it really be that using a PersistentList is 300 times slower? Am
> I doing something completely wrong, or am I missing something?

In your test setup, you commit the transaction and close the
connection. This means that when you iterate through the edges, not
only do you load buckets, but for each item in the bucket, you load an
additional persistent object, namely the `PersistentList`.

This doesn't happen when you persist a Python list. In that case, the
list is simply persisted right into the bucket data. This makes the
buckets take up more space, but you need less reads from disk which
makes the whole thing go a lot faster.

Note that once you've loaded all the `PersistentList` objects,
iterating again should go much faster because it's now all in memory.

\malthe


More information about the ZODB-Dev mailing list