[Python-Dev] Unpickling memory usage problem, and a proposed solution

Antoine Pitrou solipsis at pitrou.net
Fri Apr 23 23:24:10 CEST 2010


Collin Winter <collinwinter <at> google.com> writes:
> 
> I don't think it's possible in general to remove any PUTs if the
> pickle is being written to a file-like object.

Does cPickle bytecode have some kind of NOP instruction?
You could keep track of which PUTs weren't necessary and zero them out at the
end. It would be much cheaper than writing a whole other "optimized" stream.

(of course it only works on a seekable stream :-))

Regards

Antoine.




More information about the Python-Dev mailing list