You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[...] -- it executes the stat() system call or GetFileAttributes() on each file to determine whether the entry is a directory or not.
But the underlying system calls -- FindFirstFile / FindNextFile on Windows and readdir on POSIX systems -- already tell you whether the files returned are directories or not, so no further system calls are needed. Further, the Windows system calls return all the information for a stat_result object on the directory entry, such as file size and last modification time.
Our current readdir just returns the raw Paths, discarding this information.
Reusing that information would likely allow us to see speed-ups for walk_dir similar to those seen in that PEP:
In practice, removing all those extra system calls makes os.walk() about 8-9 times as fast on Windows, and about 2-3 times as fast on POSIX systems
The text was updated successfully, but these errors were encountered:
This has now been exposed in terms of the yielded value from the ReadDir iterator, we should be free to add various accessors in the future if necessary.
According to http://legacy.python.org/dev/peps/pep-0471/
Our current
readdir
just returns the rawPath
s, discarding this information.Reusing that information would likely allow us to see speed-ups for
walk_dir
similar to those seen in that PEP:The text was updated successfully, but these errors were encountered: