Message363742
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. |
|
Date |
User |
Action |
Args |
2020-03-09 15:19:36 | remi.lapeyre | set | recipients:
+ remi.lapeyre, pitrou, serhiy.storchaka, xtreak, barneygale |
2020-03-09 15:19:36 | remi.lapeyre | set | messageid: <1583767176.64.0.312342022467.issue39907@roundup.psfhosted.org> |
2020-03-09 15:19:36 | remi.lapeyre | link | issue39907 messages |
2020-03-09 15:19:36 | remi.lapeyre | create | |
|