cpython/Lib/importlib/metadata
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
..
__init__.py gh-109653: Improve import time of importlib.metadata / email.utils (#114664) 2024-01-29 01:30:22 -08:00
_adapters.py gh-113174: Sync with importlib_metadata 7.0 (#113175) 2023-12-21 15:04:05 -05:00
_collections.py bpo-43926: Cleaner metadata with PEP 566 JSON support. (GH-25565) 2021-05-02 17:03:40 -04:00
_functools.py bpo-44893: Implement EntryPoint as simple class with attributes. (GH-30150) 2021-12-16 15:49:42 -05:00
_itertools.py bpo-44893: Implement EntryPoint as simple class with attributes. (GH-30150) 2021-12-16 15:49:42 -05:00
_meta.py gh-113174: Sync with importlib_metadata 7.0 (#113175) 2023-12-21 15:04:05 -05:00
_text.py bpo-44893: Implement EntryPoint as simple class with attributes. (GH-30150) 2021-12-16 15:49:42 -05:00
diagnose.py gh-113174: Sync with importlib_metadata 7.0 (#113175) 2023-12-21 15:04:05 -05:00