[New-bugs-announce] [issue32596] Lazy import concurrent.futures.process and thread

INADA Naoki report at bugs.python.org
Fri Jan 19 05:54:10 EST 2018


New submission from INADA Naoki <songofacandy at 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 <report at bugs.python.org>
<https://bugs.python.org/issue32596>
_______________________________________


More information about the New-bugs-announce mailing list