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

Guido van Rossum guido at python.org
Fri Sep 21 10:26:26 EDT 2018

> What about the small integers cache?

I believe the small integers cache is only used to reduce the number of
objects -- I don't think there's any code (in CPython itself) that just
*assumes* that because an int is small it must be in the cache. So it
should be fine.

On Thu, Sep 20, 2018 at 11:23 PM Stefan Behnel <stefan_ml at behnel.de> wrote:

> Larry Hastings schrieb am 14.09.2018 um 23:27:
> > What the patch does: it takes all the Python modules that are loaded as
> > part of interpreter startup and deserializes the marshalled .pyc file
> into
> > precreated objects stored as static C data.
> What about the small integers cache? The C serialisation generates several
> PyLong objects that would normally reside in the cache. Is this handled
> somewhere? I guess the cache could entirely be loaded from the data
> segment. And the same would have to be done for interned strings. Basically
> anything that CPython only wants to have one instance of.
> That would severely limit the application of this optimisation to external
> modules, though. I don't see a way how they could load their data
> structures from the data segment without duplicating all sorts of
> "singletons".
> Stefan
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> https://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe:
> https://mail.python.org/mailman/options/python-dev/guido%40python.org

--Guido van Rossum (python.org/~guido)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20180921/3db77832/attachment.html>

More information about the Python-Dev mailing list