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 vstinner
Recipients abacabadabacaba, akira, benhoyt, giampaolo.rodola, josh.r, pitrou, socketpair, tebeka, tim.golden, vstinner
Date 2015-02-12.22:09:04
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
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
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...

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
Date User Action Args
2015-02-12 22:09:04vstinnersetrecipients: + vstinner, tebeka, pitrou, giampaolo.rodola, tim.golden, benhoyt, abacabadabacaba, akira, socketpair, josh.r
2015-02-12 22:09:04vstinnersetmessageid: <>
2015-02-12 22:09:04vstinnerlinkissue22524 messages
2015-02-12 22:09:04vstinnercreate