Python File Iterator Performance
Often I find myself writing Python scripts to iterate over the files in a directory for fun and profit. This is so common that I wrote a simple helper function in Auxly called walkfiles()
. The performance of walkfiles()
always felt kinda sluggish, especially when compared to blazing fast utilities like fd. Only recently did I learn about os.scandir()
in the Python standard library which is essentially a more performant os.listdir()
. After some benchmarks …