[Python-Dev] Store startup modules as C structures for 20%+ startup speed improvement?
carl.shapiro at gmail.com
Fri Sep 21 15:01:15 EDT 2018
On Thu, Sep 20, 2018 at 11:20 PM, Stefan Behnel <stefan_ml at behnel.de> wrote:
> 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.
Un-marshaled immutable objects are tracked in a table to ensure their
uniqueness. Thanks for mentioning the small integer cache. It is not part
of the change, but it could be brought under this framework. By doing so,
we could store the small integer objects instances in the data segment and
other data segment objects could reference those unique small integer
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
Yes, additional load-time work would have to be done to ensure the
uniqueness of those objects.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-Dev