[Python-Dev] Store startup modules as C structures for 20%+ startup speed improvement?

Carl Shapiro carl.shapiro at gmail.com
Thu Sep 20 14:21:06 EDT 2018


On Wed, Sep 19, 2018 at 12:32 AM, Stefan Behnel <stefan_ml at behnel.de> wrote:

> Also, one thing that would be interesting to find out is whether constant
> Python data structures can actually be pre-allocated in the data segment
> (and I mean their object structs) . Then things like tuples of strings
> (argument lists and what not) could be loaded and the objects quickly
> initialised (although, is that even necessary?), rather than having to heap
> allocate and create them. Probably something that we should try out in
> Cython.
>

I might not be fully understanding the scope of your question but this
patch does allocate constant data structures in the data segment.  We could
be more aggressive with that but we limit our scope to what is presented to
the un-marshaling code.  This may be relevant to Cython, as well.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20180920/0a550e59/attachment.html>


More information about the Python-Dev mailing list