[Python-Dev] Python startup time

Antoine Pitrou solipsis at pitrou.net
Fri Jul 21 04:54:32 EDT 2017


On Fri, 21 Jul 2017 00:12:20 -0700
David Mertz <mertz at gnosis.cx> wrote:
> How implausible is it to write out the actual memory image of a loaded
> Python process? I.e. on a specific machine, OS, Python version, etc? This
> can only be overhead initially, of course, but on subsequent runs it's just
> one memory map, which the cheapest possible operation.

You can't rely on the file being remapped at the same address when you
reload it.  So you'd have to write a relocation routine that's able to
find and fix *all* pointers inside the Python object tree and CPython's
internal structures (fixing the pointers is not necessarily difficult,
finding them without missing any is the difficult part).

Regards

Antoine.




More information about the Python-Dev mailing list