Xavier de Gaye added the comment: FWIW I have followed the idea of having _iterdir() yielding the DirEntry entry instead of the name in Serhiy's patch. There is a slight performance gain. Now _glob0() and _glob1() do return a list of directories when dironly is true but there is now another place where OSError must be tracked, so it is not clear if this is worth it.
glob_scandir_2_diff.patch is the differential patch between glob_scandir_2.patch and glob_scandir_3.patch. Here are the performance tests run with both patches. $ ./python -m timeit -s "from glob import glob" -- "glob('**/*', recursive=True)" glob_scandir_2.patch: 33.1 msec per loop glob_scandir_3.patch: 33.8 msec per loop $ ./python -m timeit -s "from glob import glob" -- "glob('/usr/lib*/**/*', recursive=True)" glob_scandir_2.patch: 927 msec per loop glob_scandir_3.patch: 850 msec per loop $ ./python -m timeit -s "from glob import glob" -- "glob('/usr/lib*/**/', recursive=True)" glob_scandir_2.patch: 423 msec per loop glob_scandir_3.patch: 337 msec per loop ---------- Added file: http://bugs.python.org/file41570/glob_scandir_2_diff.patch _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue25596> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com