On Sat, 8 May 2021 02:58:40 +0000
Neil Schemenauer <nas-pyt...@arctrix.com> wrote:
> On 2021-05-07, Pablo Galindo Salgado wrote:
> > Technically the main concern may be the size of the unmarshalled
> > pyc files in memory, more than the storage size of disk.  
> 
> It would be cool if we could mmap the pyc files and have the VM run
> code without an unmarshal step.

What happens if another process mutates or truncates the file while the
CPython VM is executing code from the mapped file?  Crash?

> Instead, could we dump out the pyc data in a format similar to Cap'n
> Proto?  That way no unmarshal is needed.

How do you freeze PyObjects in Cap'n Proto so that no unmarshal is
needed when loading them?

> The benefit would be faster startup times.  The unmarshal step is
> costly.

How costly? Do we have numbers?

> It would mostly solve the concern about these larger
> linenum/colnum tables.  We would only load that data into memory if
> the table is accessed.

Memory-mapped files are accessed with page granularity (4 kB on x86), so
I'm not sure it's that simple.  You would have to make sure to store
those tables in separate sections distant from the actual code areas.

Regards

Antoine.


_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/R57VMAURJIA3DZKMRTBK35CTMDS5JCDZ/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to