Message257347
| Author |
serhiy.storchaka |
| Recipients |
benhoyt, serhiy.storchaka, vstinner, xdegaye |
| Date |
2016年01月02日.15:22:51 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1451748173.23.0.92412199199.issue25596@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
In general the patch LGTM. It allows to speed up glob by 5-10% in warn test. But much more gain we can achieve by using os.scandir(). Here are results of microbenchmarks:
$ ./python -m timeit -s "from glob import glob" -- "glob('**/*', recursive=True)"
Unpatched: 201 msec per loop
Using isdir(): 181 msec per loop
Using scandir(): 65.2 msec per loop
$ ./python -m timeit -s "from glob import glob" -- "glob('/usr/lib*/**/*', recursive=True)"
Unpatched: 2.06 sec per loop
Using isdir(): 1.92 sec per loop
Using scandir(): 820 msec per loop
$ ./python -m timeit -s "from glob import glob" -- "glob('/usr/lib*/**/', recursive=True)"
Unpatched: 1.77 sec per loop
Using isdir(): 1.61 sec per loop
Using scandir(): 431 msec per loop
Yet one benefit is that iglob() now yields path names without the delay for reading the full content of a directory (see issue22167). |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2016年01月02日 15:22:53 | serhiy.storchaka | set | recipients:
+ serhiy.storchaka, vstinner, benhoyt, xdegaye |
| 2016年01月02日 15:22:53 | serhiy.storchaka | set | messageid: <1451748173.23.0.92412199199.issue25596@psf.upfronthosting.co.za> |
| 2016年01月02日 15:22:53 | serhiy.storchaka | link | issue25596 messages |
| 2016年01月02日 15:22:52 | serhiy.storchaka | create |
|