mirror of https://github.com/python/cpython
Browse Source
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
```
---
pull/27747/head
committed by
GitHub
3 changed files with 539 additions and 517 deletions
1031
Python/importlib.h
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
Loading…
Reference in new issue