Alan.Bateman at Sun.COM
Sun Sep 6 13:41:07 PDT 2009
John Hendrikx wrote:
> I forgot one thing I thought of yesterday. Files.walkFileTree does
> not provide BasicFileAttributes for directories (preVisitDirectory
> does not supply them). This would mean the performance problems would
> return if the directory being scanned contains a lot of
> subdirectories, as in that case even with the FileVisitor I would be
> forced to call readBasicFileAttributes.
> It might be worth consideration to supply preVisitDirectory with
> BasicFileAttributes as well.
Right, it could help for the case where the directory attributes are
needed, reading them is slow (such as using SMB), and where the ratio of
directories to other file types is high. Even if the ratio isn't that
high, there there may be some small benefit. So yes, worth looking at.
Also postVisitDirectory (such as the "cp -r" case) but that isn't as
clear cut as it would only be beneficial if the attributes from before
the directory is visited are useful.
More information about the nio-dev