[Python-ideas] Speed up os.walk() 5x to 9x by using file attributes from FindFirst/NextFile() and readdir()
random832 at fastmail.us
Mon Nov 19 02:32:44 CET 2012
On 11/18/2012 3:52 PM, Ben Hoyt wrote:
> Still, it's definitely worth the huge speedup on Windows
It occurs to me that we need to be careful in defining what we can
actually get on Linux or Windows.
Linux readdir can return the file type, but it's always going to be
DT_LNK for symlinks, requiring an extra stat call if followlinks=True.
Windows functions return both "is a symlink" and "is a directory" in a
single call (ntpath.isdir / nt._isdir takes advantage of this, and the
same information is present in the Find functions' data) but not other
information about the symlink target beyond whether it is a directory.
Neither python's existing stat function nor anything proposed here has a
way of representing this, but it would be useful for os.walk to be able
to get this information.
More information about the Python-ideas