durusmail: durus-users: Eliminate __dict__ from persistent btree, bnode, dict, list and set
Eliminate __dict__ from persistent btree, bnode, dict, list and set
Eliminate __dict__ from persistent btree, bnode, dict, list and set
2006-07-05
2006-07-05
2006-07-05
2006-07-06
2006-07-06
2006-07-06
XMPP/Jabber chatting (was: Re: [Durus-users] Eliminate __dict__ from persistent btree, bnode, dict, list and set)
2006-10-31
Re: XMPP/Jabber chatting
2006-10-31
Eliminate __dict__ from persistent btree, bnode, dict, list and set
Patrick K. O'Brien
2006-07-05
David Binger wrote:
>
> It would be nice, also, while reducing the RAM requirements for these
> things,
> to also reduce the disk requirement by leaving the dict with 'data' out
> of the
> state.  I know that you did that so that old pickles would still work
> the same
> way, and that is reasonable.  Is there a way to achieve that objective
> at the
> same time?  I'm thinking about it more.

I have one idea.  Instead of PersistentDict.data being a dict, it could
be a subclass of dict.  Then __setstate__ could test the incoming state
to see if it is a regular dict or our special subclass.  But that would
trade off physical disk savings against type inspection within
__setstate__, which gets called a lot.  I'm not sure that would be
worthwhile.  The alternative would be a one-time conversion routine.
Unless you think of something better.

--
Patrick K. O'Brien
Orbtech       http://www.orbtech.com
Schevo        http://www.schevo.org
Louie         http://www.pylouie.org
reply