BTree vs dictionary
Now that I know how to use BTrees I grew fond of it and the features it offers. 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? Thanks for the help, Yair -- Yair Benita Utrecht University The Netherlands
--On 16. Juni 2005 17:32:15 +0200 Yair Benita <y.benita@wanadoo.nl> wrote:
Now that I know how to use BTrees I grew fond of it and the features it offers.
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).
If you need BTree features then use BTrees. If you don't need any of them better use dictionaries. Dicts are somehwat faster than BTrees but BTrees should be used in any way when working with the ZODB. -aj
[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
participants (3)
-
Andreas Jung -
Tim Peters -
Yair Benita