[Python-Dev] Store startup modules as C structures for 20%+ startup speed improvement?
solipsis at pitrou.net
Sun Sep 16 16:24:41 EDT 2018
On Fri, 14 Sep 2018 14:27:37 -0700
Larry Hastings <larry at hastings.org> wrote:
> I don't propose to merge the patch in its current state. I think it
> would need a lot of work both in terms of "doing things the way Python
> does it" as well as just code smell (the serializer is implemented in
> both C and Python and jumps back and forth, also the build process for
> the serialized modules is pretty tiresome).
> Is it worth working on?
I think it's of limited interest if it only helps with modules used
during the startup sequence, not arbitrary stdlib or third-party
To give an idea, on my machine the baseline Python startup is about 20ms
(`time python -c pass`), but if I import Numpy it grows to 100ms, and
with Pandas it's more than 200ms. Saving 4ms on the baseline startup
would make no practical difference for concrete usage.
I'm ready to think there are other use cases where it matters, though.
More information about the Python-Dev