Serhiy Storchaka <[email protected]> added the comment:
> Less reliable how?
See issue39916.
> so it looks like scandir as a small overhead when accumulating all results
> and not using the extra info it returns.
Try with larger directories. The difference may be not so small.
$ python3 -m timeit -s 'from os import scandir' "list(scandir('/usr/include'))"
10000 loops, best of 3: 176 usec per loop
$ python3 -m timeit -s 'from os import listdir' "listdir('/usr/include')"
10000 loops, best of 3: 114 usec per loop
----------
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue39907>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com