New submission from Barney Gale <barney.g...@gmail.com>:

I have a scratchy patch that replaces pathlib's globbing implementation with 
glob.glob(), which gained a `root_dir` argument in bpo-38144

Encouraging timings:

$ ./python -m timeit -s "from pathlib import Path; p = Path()" -- 
"list(p.glob('**/*'))"
Unpatched: 43.2 msec per loop
Patched:   4.37 msec per loop

$ ./python -m timeit -s "from pathlib import Path; p = Path('/usr/')" -- 
"list(p.glob('lib*/**/*'))"
Unpatched: 248 msec per loop
Patched:   56.8 msec per loop

$ ./python -m timeit -s "from pathlib import Path; p = Path('/usr/')" -- 
"list(p.glob('lib*/**/'))"
Unpatched: 78.3 msec per loop
Patched:   2.23 msec per loop

Patch to follow.

----------
components: Library (Lib)
messages: 393556
nosy: barneygale
priority: normal
severity: normal
status: open
title: Use glob.glob() to implement pathlib.Path.glob()
type: performance
versions: Python 3.11

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue44119>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to