Message316266
Due to a python-ideas discussion about reducing boilerplate for __file__-relative path calculations, I was running "./python -X importtime -S -c 'import pathlib'" and noticed three potential candidates where it may be worthwhile deferring the imports until the modules are actually needed:
- re (used in _WildcardSelector)
- fnmatch (used in PurePath.match and _WildcardSelector)
- urllib.parse (used in PurePath.as_uri, by way of self._flavour.make_uri)
Using an optimised Python 3.7 on an SSD with warm disk caches, commenting out those 3 imports reduced my typical import times for pathlib from 12-13 ms to 7-8 ms) |
|
Date |
User |
Action |
Args |
2018-05-07 12:28:40 | ncoghlan | set | recipients:
+ ncoghlan, pitrou, njs |
2018-05-07 12:28:40 | ncoghlan | set | messageid: <1525696120.71.0.682650639539.issue33440@psf.upfronthosting.co.za> |
2018-05-07 12:28:40 | ncoghlan | link | issue33440 messages |
2018-05-07 12:28:40 | ncoghlan | create | |
|