This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients methane, rhettinger, serhiy.storchaka, vstinner
Date 2017-01-24.09:56:12
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1485251772.91.0.148731279986.issue29336@psf.upfronthosting.co.za>
In-reply-to
Content
> Thanks.  Your patch reduced memory consumption by 2%,

merge-constants.patch looks simple enought, but I'm not really impressed by such result. Is 2% worth it?

Since code objects loaded by import are likely for stay for the whole lifetime of a process, I would be interested to experiment interning all constant objects (the tuple of objects, but also each object of these tuples, so support "nested interning") of all code objets (consts, names, varnames, freevars, cellvars) in the marshal module.

To intern constants, we need to generate an unique key to not merge 1 int and 1.0 float. The risk of such global intern dict is to increase the memory usage of the unique keys uses more memory than the decreased caused by the removal of duplicate objects.

More generally, would it be possible to share co_consts (None,) tuples between code objects of two different modules? Or is it already the case with merge-constants.patch?
History
Date User Action Args
2017-01-24 09:56:12vstinnersetrecipients: + vstinner, rhettinger, methane, serhiy.storchaka
2017-01-24 09:56:12vstinnersetmessageid: <1485251772.91.0.148731279986.issue29336@psf.upfronthosting.co.za>
2017-01-24 09:56:12vstinnerlinkissue29336 messages
2017-01-24 09:56:12vstinnercreate