[Python-Dev] os.walk() is going to be *fast* with scandir

Antoine Pitrou antoine at python.org
Sun Aug 10 05:20:27 CEST 2014


Le 09/08/2014 12:43, Ben Hoyt a écrit :
> Just thought I'd share some of my excitement about how fast the all-C
> version [1] of os.scandir() is turning out to be.
>
> Below are the results of my scandir / walk benchmark run with three
> different versions. I'm using an SSD, which seems to make it
> especially faster than listdir / walk. Note that benchmark results can
> vary a lot, depending on operating system, file system, hard drive
> type, and the OS's caching state.
>
> Anyway, os.walk() can be FIFTY times as fast using os.scandir().

Very nice results, thank you :-)

Regards

Antoine.




More information about the Python-Dev mailing list