I like where this is going. It would be nice if certain constants could also be loaded from RO memory.
On Mon, Jun 22, 2020 at 00:16 Inada Naoki <songofaca...@gmail.com> wrote: > On Mon, Jun 22, 2020 at 12:00 AM Guido van Rossum <gu...@python.org> > 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 <songofaca...@gmail.com> > -- --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/7QFQUUAKA24PAZNSPYQKLMKGK6DVZA5U/ Code of Conduct: http://python.org/psf/codeofconduct/