Fw: Patch for File Scanning

Rémi Forax forax at univ-mlv.fr
Sun Oct 9 17:02:26 PDT 2011

On 10/10/2011 01:23 AM, Alan Bateman wrote:
> 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 WindowsPathWithAttributes
>> A change that I am not sure about is  - there was a WeakReference to 
>> the attributes which I have set to final in this patch, but there may 
>> be some subtlety that I am missing
> Mike - I don't have cycles to examine the patch in detail just now but 
> I wonder about the changes to Files. Your change means that Filter is 
> eagerly loaded which isn't desirable.

You can solve this by using the lazy loading of the class.

static class AcceptAllFilter implements Filter<Object> {
       static final Filter<Object> ACCEPT_ALL = new AcceptAllFilter();

       public boolean accept(Object entry) {
           return true;

return provider(dir).newDirectoryStream(dir, AcceptAllFilter.ACCEPT_ALL);

> Also the changes to the javadoc don't look right - did you mean to 
> change the javadoc?
> -Alan


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/nio-dev/attachments/20111010/9f52e1db/attachment.html 

More information about the nio-dev mailing list