durusmail: durus-users: PersistentDict vs BTree
PersistentDict vs BTree
2006-10-03
2006-10-03
2006-10-03
2006-10-03
2006-10-05
2006-10-05
2006-10-05
2006-10-05
2006-10-11
2006-10-11
2006-10-11
2006-10-12
2006-10-12
2006-10-12
2006-10-13
2006-10-13
2006-10-13
2006-10-13
2006-10-13
2006-10-13
Re: PersistentDict vs BTree
2006-10-23
2006-10-31
PersistentDict vs BTree
Mike Orr
2006-10-12
On 10/12/06, David Binger  wrote:
> This seems llike a Python issue more than a Durus one.

That occurred to me after I sent the message.  I've been looking over
the Durus source, and the only amount of data it seems to add are four
little attributes in PersistentBase.

> I wonder, though, if you could save a lot of RAM by
> using intern() calls in a __setstate__() implementation.
> If you are using the names as keys in a BTree, there
> is another copy there, too, and there might be another
> chance to use intern() for some advantage.

The keys are actually ints. I looked at intern() yesterday in the
Python docs but for the purpose of making sure duplicate names were
the same object. I thought that was one of intern's features but it's
not mentioned in the docs. It says intern() just possibly increases
speed with dictionary lookups... but then it says all keys and
attribute names are automatically intern'ed anyway.  So if BTree isn't
doing this too, maybe it should.

At one point I had an extra set or dictionary of names to pass all
imported names through, to guarantee that duplicates would be shared,
but I eliminated it because it didn't seem to make a difference.

--
Mike Orr 
reply