STINNER Victor added the comment: Similar benchmark result on my laptop which has a SSD (ext4 filesystem tool, but I guess that the directory is small and fits into the memory).
Note: I'm not sure that the "between ...x and ...x faster" are revelant, I'm not sure that my computation is correct. Test listdir+stat vs scandir+is_dir Temporary directory: /home/haypo/prog/python/default/tmpbrn4r2tv Create 100000 files+symlinks... Create 10000 directories... # entries: 210000 Benchmark... listdir: 1730.7 ms scandir: 1029.4 ms listdir: 476.8 ms scandir: 1058.3 ms listdir: 485.4 ms scandir: 1041.1 ms Remove the temporary directory... Result: listdir: min=476.8 ms (2.3 us per file), max=1730.7 ms (8.2 us per file) scandir: min=1029.4 ms (4.9 us per file), max=1058.3 ms (5.0 us per file) scandir is between 0.5x and 1.7x faster ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue22524> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com