A lot of the paths methods are significantly slower then they could be.
I've found when invoked frequently (such as once per path in a large glob result) doing simple string manipulation is sometimes 10-100x faster (300+s to <10s in some instances). Primarily methods such as paths.replace_extension and paths.split_extension, and the underlying paths.basename. I think the primary reason being the creation of arrays/tuples only to extract a single string out of the array?
A lot of the
paths
methods are significantly slower then they could be.I've found when invoked frequently (such as once per path in a large
glob
result) doing simple string manipulation is sometimes 10-100x faster (300+s to <10s in some instances). Primarily methods such aspaths.replace_extension
andpaths.split_extension
, and the underlyingpaths.basename
. I think the primary reason being the creation of arrays/tuples only to extract a single string out of the array?