On Mon, Jun 22, 2020 at 12:00 AM Guido van Rossum <[email protected]> wrote:
>
>
> 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.
>
memoryview is heavy object. Using memoryview instead of bytes object
will increase memory usage.
I think lightweight bytes-like object is better. My rough idea is:
* New code and pyc format
* pyc has "rodata" segment
* It can be copied into single memory block, or can be mmapped.
* co_code should be aligned at least 2 bytes.
* code.co_code can point to memory block in "rodata".
* docstring, signature, and lnotab can be lazy load from "rodata".
* signature is serialized in JSON like format.
* Allow multiple modules in single file
* Reduce fileno when using mmap
* Merge more constants
* New Python object: PyROData.
* It is like read-only bytearray.
* But body may be mmap-ped, instead of malloc-ed
* code objects owns reference of PyROData.
* When PyROData is deallocated, it munmap or free "rodata" segment.
Regards,
--
Inada Naoki <[email protected]>
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/[email protected]/message/VKBXY7KDI2OGESB7IPAMAIIHKR4TC7TQ/
Code of Conduct: http://python.org/psf/codeofconduct/