[Python-ideas] Speed up os.walk() 5x to 9x by using file attributes from FindFirst/NextFile() and readdir()

Serhiy Storchaka storchaka at gmail.com
Wed Nov 14 11:54:07 CET 2012

On 14.11.12 11:53, Robert Collins wrote:
>   - chdir to the directory before you stat and use a relative path: it
> turns out when working with many files that the overhead of absolute
> paths is substantial.

Look at fwalk(). It reaches the same benefits without changing of process-global cwd (i.e. it is thread-safe).

More information about the Python-ideas mailing list