Bug report
Pathlib.rglob can be orders of magnitudes slower than glob.glob(recursive=True)
With a 1000-deep nested directory, glob.glob and Path.glob both took under 1 second. Path.rglob took close to 1.5 minutes.
import glob
import os
from pathlib import Path
x = ""
for _ in range(1000):
x += "a/"
os.mkdir(x)
# ~ 0.5s
print(glob.glob("**/*", recursive=True))
# ~ 87s
print(list(Path(".").rglob("**/*")))
Linked PRs
Bug report
Pathlib.rglob can be orders of magnitudes slower than
glob.glob(recursive=True)With a 1000-deep nested directory,
glob.globandPath.globboth took under 1 second.Path.rglobtook close to 1.5 minutes.Linked PRs
pathlib.Path.rglob()#104244pathlib.Path.glob()#104373pathlib.Path.glob()#104512