Re: [Python-Dev] Lazy initialization of module global state

2017-09-08 Thread Nick Coghlan
On 8 September 2017 at 08:50, Neil Schemenauer wrote: > This should be pretty safe to do and should give a significant > benefit in startup time and memory usage. And given the extended pyc header being proposed in PEP 552, we'd be able to include flags in the header to indicate that the pyc file

[Python-Dev] Lazy initialization of module global state

2017-09-08 Thread Neil Schemenauer
This is an idea that came out of the lazy module loading (via AST analysis), posted to python-ideas. The essential idea is to split the marshal data stored in the .pyc into smaller pieces and only load the parts as they are accessed. E.g. use a __getattr__ hook on the module to unmarshal+exec the