Message257912
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 |
|
Date |
User |
Action |
Args |
2016-01-10 14:53:35 | xdegaye | set | recipients:
+ xdegaye, gvanrossum, vstinner, benhoyt, serhiy.storchaka |
2016-01-10 14:53:35 | xdegaye | set | messageid: <1452437615.1.0.340857236849.issue25596@psf.upfronthosting.co.za> |
2016-01-10 14:53:35 | xdegaye | link | issue25596 messages |
2016-01-10 14:53:34 | xdegaye | create | |
|