Serhiy Storchaka added the comment:

Proposed minimal patch implements globbing in pathlib using os.scandir(). Here 
are results of microbenchmarks:

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

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

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

See msg257954 in issue25596 for comparison with the glob module.

----------
assignee:  -> serhiy.storchaka
keywords: +patch
stage:  -> patch review
Added file: http://bugs.python.org/file41577/pathlib_glob_scandir.patch

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

Reply via email to