New submission from INADA Naoki <songofaca...@gmail.com>:

Since PEP 562 is implemented, we can use lazy imports easily.

Asyncio uses concurrent.futures.Future and 
concurrent.futures.ThreadPoolExecutor,
but not concurrent.futures.ProcessPoolExecutor by default.

Since importing concurrent.futures.process is slow, I want to import it lazily.
And it make sense to import concurrent.futures.thread too, because it's very
easy when we start to use __getattr__ once.

Here is quick benchmark:


$ ./python -m perf command ./python -c 'import asyncio'  # patched
.....................
command: Mean +- std dev: 60.5 ms +- 0.1 ms
$ git stash
$ ./python -m perf command ./python -c 'import asyncio'  # original
.....................
command: Mean +- std dev: 74.3 ms +- 0.2 ms

----------
components: Library (Lib)
messages: 310272
nosy: inada.naoki, levkivskyi, yselivanov
priority: normal
severity: normal
status: open
title: Lazy import concurrent.futures.process and thread
type: enhancement
versions: Python 3.7

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue32596>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to