mirror of
https://github.com/python/cpython.git
synced 2025-11-03 11:23:31 +00:00
Implements a two steps check in `importlib._bootstrap._find_and_load()` to avoid locking when the module has been already imported and it's ready.
---
Using `importlib.__import__()`, after this, does show a big difference:
Before:
```
$ ./python -c 'import timeit; print(timeit.timeit("__import__(\"timeit\")", setup="from importlib import __import__"))'
15.92248619502061
```
After:
```
$ ./python -c 'import timeit; print(timeit.timeit("__import__(\"timeit\")", setup="from importlib import __import__"))'
1.206068897008663
```
---
|
||
|---|---|---|
| .. | ||
| metadata | ||
| __init__.py | ||
| _abc.py | ||
| _adapters.py | ||
| _bootstrap.py | ||
| _bootstrap_external.py | ||
| _common.py | ||
| _itertools.py | ||
| _legacy.py | ||
| abc.py | ||
| machinery.py | ||
| readers.py | ||
| resources.py | ||
| simple.py | ||
| util.py | ||