6 Aug
2002
6 Aug
'02
7:35 p.m.
pickle currently puts tuples into the memo on pickling, but only ever uses the position field ([0]), never the object itself ([1]). I understand that the reference to the object is needed to keep it alive while pickling. Unfortunately, this means one needs to allocate 36 bytes for the tuple. I think this memory consumption could be reduced by saving the objects in a list, and only saving the position in the memo dictionary. That would save roughly 32 bytes per memoized object, assuming there is no malloc overhead. What do you think? Regards, Martin P.S. It would be even more efficient if there was an identity dictionary.