Serhiy Storchaka added the comment:

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

I'm not impressed too. And merging constants can take time.

> 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.

This could slow down marhalling. Some patches in issue20416 implements this, 
but current code is faster and much simpler and the benefit of deduplicating 
constants is too small.

> 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?

All patches in this issue shares constants only in one compilation unit 
(module). Otherwise the global intern dict would increase the memory usage too 
much.

See also the statistics in issue16475. The most memory is spent by strings, and 
the majority of strings already are interned.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue29336>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to