[Zope-dev] BTree vs dictionary

Tim Peters tim.peters at gmail.com
Thu Jun 16 12:28:42 EDT 2005


[Yair Benita]
> Now that I know how to use BTrees I grew fond of it and the features it
> offers.

Yup, they're very cool.

> While the advantages of using BTrees are obvious when using it in a database
> context, I was wondering if it makes sense to use it instead of a dictionary
> routinely, just so I can take advantage of commands such as t(min=1, max=4).
>
> As I have no idea about the code that make the BTree tick, I was wondering:
> does anybody advise against it? Should I be extra careful about some things?

They're generally slower than dicts.  Other than that, there are
"gotchas" (surprises, pitfalls) in using BTrees, and in using dicts,
but they're generally different gotchas.  See the section on BTrees in
the ZODB Programming Guide for some hideous details, section 5.3:

    http://www.zope.org/Wikis/ZODB/FrontPage/guide/index.html


More information about the Zope-Dev mailing list