Which is fastest dict or list.index() ?

Andreas Jung andreas at andreas-jung.com
Tue Jun 4 06:15:16 EDT 2002

"VanL" <news at lindbergs.org> wrote in message
news:3CFC3D6A.5010706 at lindbergs.org...

> I guess I am asking what you mean by sluggish. Sluggish as
> in "I get 10,000 ops per second on a Btree, but 100,000 ops
> per second on a dict" or sluggish as in "I only get 10 ops
> per second on a Btree because I have to go to disk every
> time I pull a node?"

It will be hard to beat Python dictionaries in performance since
they are very heavily optimized. Zope BTrees are optimized for
usage inside the ZODB and they can keep large data without loading
the complete datastructure into memory. See also


More information about the Python-list mailing list