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

Christian Heimes christian at python.org
Fri Nov 9 16:06:48 CET 2012


Am 09.11.2012 15:54, schrieb Serhiy Storchaka:
> The only fields in the dirent structure that are mandated by POSIX.1 are: d_name[], of unspecified size, with at most NAME_MAX characters preceding the terminating null byte; and (as an XSI extension) d_ino. The other fields are unstandardized, and not present on all systems.


I'm well aware of the fact.The idea is to use as many information as we
can get for free and acquire missing information from other sources like
stat().

Also some information depend on the file system:

Currently,  only  some file systems (among them: Btrfs, ext2, ext3, and
ext4) have full support returning the file type in d_type.  All
applications must properly handle a return of DT_UNKNOWN.






More information about the Python-ideas mailing list