On Sun, Jun 21, 2020 at 02:53 M.-A. Lemburg <m...@egenix.com> wrote:

> On 21.06.2020 01:47, Guido van Rossum wrote:
> > Hm, I remember Greg's free threading too, but that's not the idea I was
> > trying to recall this time. There really was something about bytecode
> > objects being loaded from a read-only segment to speed up code loading.
> > (Much quicker than unmarshalling a .pyc file.) I don't think we ever got
> > the details worked out to the point where we could benchmark.
>
> Perhaps you are thinking about reading byte code from C arrays,
> as is done when freezing Python modules.
>
> I'm using this logic in PyRun to freeze (more or less) the entire
> Python stdlib.
>
> It does have some effect on startup time and due
> to the OS typically sharing such static code segments between
> processes helps a bit when you run multiple processes, but since
> the C arrays only store byte code and not code objects, you still
> need to create code objects and store a copy of the byte code
> in memory for every single process.
>
> This could probably be optimized by having the code object
> point to the C array to hold the byte code data, but I haven't
> looked into that.


I believe this was what Greg Stein's idea here was about. (As well as
Jonathan Fine's in this thread?) But the current use of code objects makes
this hard. Perhaps the code objects could have a memoryview object to hold
the bytecode instead of a bytes object.

--Guido
-- 
--Guido (mobile)
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/6C6RFD67H3CF5BO4SGKAED5V7ZUQOHJO/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to