0
0
mirror of https://github.com/python/cpython.git synced 2024-11-24 00:38:00 +01:00
cpython/Lib/importlib
Shantanu 2124a3ddcc
gh-109653: Improve import time of importlib.metadata / email.utils (#114664)
My criterion for delayed imports is that they're only worth it if the
majority of users of the module would benefit from it, otherwise you're
just moving latency around unpredictably.

mktime_tz is not used anywhere in the standard library and grep.app
indicates it's not got much use in the ecosystem either.

Distribution.files is not nearly as widely used as other
importlib.metadata APIs, so we defer the csv import.

Before:
```
λ hyperfine -w 8 './python -c "import importlib.metadata"'
Benchmark 1: ./python -c "import importlib.metadata"
  Time (mean ± σ):      65.1 ms ±   0.5 ms    [User: 55.3 ms, System: 9.8 ms]
  Range (min … max):    64.4 ms …  66.4 ms    44 runs
```

After:
```
λ hyperfine -w 8 './python -c "import importlib.metadata"'
Benchmark 1: ./python -c "import importlib.metadata"
  Time (mean ± σ):      62.0 ms ±   0.3 ms    [User: 52.5 ms, System: 9.6 ms]
  Range (min … max):    61.3 ms …  62.8 ms    46 runs
```

for about a 3ms saving with warm disk cache, maybe 7-11ms with cold disk
cache.
2024-01-29 01:30:22 -08:00
..
metadata gh-109653: Improve import time of importlib.metadata / email.utils (#114664) 2024-01-29 01:30:22 -08:00
resources gh-113238: add Anchor to importlib.resources (#113801) 2024-01-16 10:55:59 +00:00
__init__.py gh-105407: Remove unused imports in the stdlib (#105411) 2023-06-06 21:13:24 +00:00
_abc.py gh-102515: Remove unused imports in the Lib/ directory (#102516) 2023-03-08 11:45:38 +00:00
_bootstrap_external.py GH-112354: END_FOR instruction to only pop one value. (GH-114247) 2024-01-24 15:10:17 +00:00
_bootstrap.py gh-112414: Fix AttributeError when calling repr() on a namespace package imported with a custom loader (#112425) 2023-11-27 08:19:29 +00:00
abc.py gh-98040: Remove find_loader, find_module and other deprecated APIs (#98059) 2023-05-03 04:55:22 -07:00
machinery.py
readers.py
simple.py
util.py Fix a misspelling of Interpeter -> Interpreter (GH-111040) 2023-10-18 15:09:45 -07:00