Which is fastest dict or list.index() ?
VanL
news at lindbergs.org
Tue Jun 4 00:09:14 EDT 2002
Hello,
I am curious about your experience with these BTrees. I am
writing an outliner with a ZODB backend in which I was going
to use these as nodes for storage (IOBTrees, probably) as
opposed to the supplied PersistentDict class.
I was planning on using a data structure that (with
extraneous stuff ommitted) looked like this:
(Note: ObjID is a unique int.)
BTree(ObjID_1: {'Content': <Stuff>,
'Connections': [Parent_ObjID,
ObjID_child1, ObjID_child2, etc]
'ID': ObjID},
ObjID_2: {'Content': <Stuff>,
'Connections': [Parent_ObjID,
ObjID_child1, ObjID_child2, etc]
'ID': ObjID},
etc.
(This is an extension of the 'ideal python graph model' as
expounded by Guido at
http://www.python.org/doc/essays/graphs.html)
The content of the various nodes (the <stuff> above) could
potentially be quite large (500 k -> 1MB per node), so I was
thinking that the BTree might be better, as it would only
bring the necessary nodes into memory.
However, your mention that these Btrees are 'sluggish'
grabbed my attention. Would it be better to pay the memory
price for speedier performance?
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?"
Thanks,
VanL
>
>
More information about the Python-list
mailing list