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 remi.lapeyre
Recipients barneygale, pitrou, remi.lapeyre, serhiy.storchaka, xtreak
Date 2020-03-09.15:19:36
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1583767176.64.0.312342022467.issue39907@roundup.psfhosted.org>
In-reply-to
Content
This is not how timeit works, you just measured the time taken by an empty loop, you can look at `python3 -m timeit -h` to get help how to call it. I think a correct invocation would be:

(venv) ➜  ~ python3 -m timeit -s 'from os import scandir' "list(scandir('/usr/local'))"
10000 loops, best of 5: 24.3 usec per loop
(venv) ➜  ~ python3 -m timeit -s 'from os import listdir' "listdir('/usr/local')"
10000 loops, best of 5: 22.2 usec per loop

so it looks like scandir as a small overhead when accumulating all results and not using the extra info it returns.
History
Date User Action Args
2020-03-09 15:19:36remi.lapeyresetrecipients: + remi.lapeyre, pitrou, serhiy.storchaka, xtreak, barneygale
2020-03-09 15:19:36remi.lapeyresetmessageid: <1583767176.64.0.312342022467.issue39907@roundup.psfhosted.org>
2020-03-09 15:19:36remi.lapeyrelinkissue39907 messages
2020-03-09 15:19:36remi.lapeyrecreate