Pathlib is slow. One of the most obvious symptoms is that pathlib.PurePath objects are slow to construct. We should be able to speed construction up without making other parts of pathlib slower.
Two possible approaches:
- Optimize the existing machinary of path construction:
__new__(), _from_parts(), _parse_parts(), _parse_args().
- Perform less work in the constructor: defer parsing, joining and normalization until needed.
Linked PRs