Fw: Patch for File Scanning
Alan.Bateman at oracle.com
Sat Oct 22 10:05:06 PDT 2011
On 09/10/2011 23:07, mike.skells at talk21.com wrote:
> Hi All,
> I have a few optimisations that I have found in nio2 Path Scanning.
> I found these during the scanning phase of the jar improvements that I
> have been working on
> The changes only really affect the first few runs thorough the code, and
> after the scan of the first 20K files there is not much difference,
> however this does mean a significant improvement for small utility apps
> (e.g. jar). Most of the improvement were if the path scanning (removing
> as string+=string that could be optimised), and changes to the
I went through your patch and put a webrev (essentially browsable diffs)
As we discussed, there isn't a typo in the javadoc so we'll ignore that.
On Files.ACCEPT_ALL then I think it's best not to add a static field to
avoid loading Filter until it is needed.
In WindowsPathParser the changes avoid concatenating "\" then the root
component already is of the format C:\. That seems reasonable to me
although the changes need to handle input such as C: as otherwise this
code will fail with IndexOutOfBoundException.
I'm not sure about the changes to WindowsPathWithAttributes. The
original intention was to allow for very temporary caching of the
attributes during the directory iteration and we don't want the Path
instance to keep the reference forever. Also the additional reference to
the parent introduced by the changes is a concern.
The changes to WindowsDirectoryStream make sense to me as it means the
entries are prefix + name rather than dir + "\" + name. Also it avoids
constructing a WindowsFileAttribtues for the links to the current
directory and the parent.
I've create a second webrev. This leaves out the changes to
WindowsPathWithAttributes and does a few clean-ups:
I'd be interested if you could repeat you tests to see how they compare
in your environment.
More information about the nio-dev