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

Random832 random832 at fastmail.us
Wed Nov 14 00:50:23 CET 2012


P.S. Something else occurs to me.

In the presence of reparse points (i.e. symbolic links) on win32, I 
believe information about whether the destination is meant to be a 
directory is still provided (I haven't confirmed this, but I know you're 
required to provide it when making a symlink). This is discarded when 
the st_mode field is populated with the information that it is a 
symlink. If the goal is "speed up os.walk", it might be worth keeping 
this information and using it in os.walk(..., followlinks=True) - maybe 
the windows version of the stat result has a field for the windows 
attributes?

It's arguable, though, that symbolic links on windows are rare enough 
not to matter.



More information about the Python-ideas mailing list