[Python-Dev] Investigating time for `import requests`

Christian Heimes christian at python.org
Mon Oct 2 05:06:17 EDT 2017


On 2017-10-02 04:04, INADA Naoki wrote:
> *3. ssl*
> 
> import time:      2007 |       2007 |                     ipaddress
> import time:      2386 |       2386 |                     textwrap
> import time:      2723 |       2723 |                     _ssl
> ...
> import time:       306 |        988 |                     base64
> import time:      2902 |      11004 |                   ssl
> 
> I already created pull request about removing textwrap dependency from ssl.
> https://github.com/python/cpython/pull/3849

Thanks for the patch. I left a comment on the PR. Please update your
patch and give me a chance to review patches next time.

> ipaddress and _ssl module are bit slow too.  But I don't know we can
> improve them or not.

The _ssl extension module has to initialize OpenSSL. It is expected to
take a while. For 3.7 I'll replace ssl.match_hostname with OpenSSL
function. The ssl module will no longer depend on re and ipaddress module.

> ssl itself took 2.9 ms.  It's because ssl has six enums.

Why are enums so slow?

Christian




More information about the Python-Dev mailing list