This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author xdegaye
Recipients benhoyt, gvanrossum, serhiy.storchaka, vstinner, xdegaye
Date 2016-01-10.14:53:34
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1452437615.1.0.340857236849.issue25596@psf.upfronthosting.co.za>
In-reply-to
Content
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
History
Date User Action Args
2016-01-10 14:53:35xdegayesetrecipients: + xdegaye, gvanrossum, vstinner, benhoyt, serhiy.storchaka
2016-01-10 14:53:35xdegayesetmessageid: <1452437615.1.0.340857236849.issue25596@psf.upfronthosting.co.za>
2016-01-10 14:53:35xdegayelinkissue25596 messages
2016-01-10 14:53:34xdegayecreate