Closed barneygale closed 6 months ago
Should be much improved in 0.2.0. There's a further possible optimization which involves repeatedly modifying the _raw_path
of a single path object, but it breaks pathlib's rules about immutability in a way that would be visible in user implementations of stat()
and readlink()
, and so we'd need to make _resolving
public to clue users into whether caching is appropriate/etc. It's all pretty complicated and probably not worth it, so I'll consider this issue resolved until someone complains.
The current implementation of this method can generate huge numbers of path objects, which is very slow.
It should be possible to rewrite it as in-place: manipulate
_raw_paths
as we go, rather than spinning up new path objects all the time. To do this we probably need to eliminate some caching - see #10