[Python-Dev] To reduce Python "application" startup time

INADA Naoki songofacandy at gmail.com
Tue Sep 5 09:02:19 EDT 2017


While I can't attend to sprint, I saw etherpad and I found
Neil Schemenauer and Eric Snow will work on startup time.

I want to share my current knowledge about startup time.

For bare (e.g. `python -c pass`) startup time,  I'm waiting C
implementation of ABC.

But application startup time is more important.  And we can improve
them with optimize importing common stdlib.

Current `python -v` is not useful to optimize import.
So I use this patch to profile import time.

With this profile, I tried optimize `python -c 'import asyncio'`, logging
and http.client.


With this small patch:

logging: 14.9ms -> 12.9ms
asyncio: 62.1ms -> 58.2ms
http.client: 43.8ms -> 36.1ms

I haven't created pull request yet.
(Can I create without issue, as trivial patch?)

I'm very busy these days, maybe until December.
But I hope this report helps people working on optimizing startup time.


INADA Naoki  <songofacandy at gmail.com>

More information about the Python-Dev mailing list