Warning: Can't synchronize with repository "(default)" (/home/git/ome.git does not appear to be a Git repository.). Look in the Trac log for more information.
Notice: In order to edit this ticket you need to be either: a Product Owner, The owner or the reporter of the ticket, or, in case of a Task not yet assigned, a team_member"

Task #6586 (closed)

Opened 13 years ago

Closed 7 years ago

Investigate more performant alternatives to File.isHidden()

Reported by: mlinkert Owned by: mlinkert
Priority: minor Milestone: Unscheduled
Component: General Version: 5.0.5
Keywords: n.a. Cc: gbonamy@…, rblistmicro@…, l.maier@…, nikolaus.ehrenfeuchter@…
Resources: n.a. Referenced By: n.a.
References: n.a. Remaining Time: n.a.
Sprint: n.a.

Description

File.isHidden() is known to be very slow on Windows and network drives.

One possibility is to replace the call to File.isHidden() with the
following (in pseudo code):

if (macOS
*nix) {

hidden = filename.startsWith(".");

}
else if (windows) {

hidden = false;
try {

FileInputStream? fis = new FileInputStream?(filename);
fis.read();

}
catch (Exception e) {

hidden = true;

}

}
else error;

I don't know what if any performance gain that would provide, though.

Attachments (1)

HiddenTest.java (2.7 KB) - added by mlinkert 7 years ago.
performance test case for File.isHidden alternatives

Download all attachments as: .zip

Change History (8)

comment:1 Changed 10 years ago by mlinkert

Partial fix for this is in https://github.com/openmicroscopy/bioformats/pull/1003, though that doesn't address performance on Windows.

comment:2 Changed 9 years ago by mlinkert

  • Cc rblistmicro@… l.maier@… added
  • Milestone changed from Unscheduled to 5.1.1
  • Version set to 5.0.5

comment:3 Changed 9 years ago by mlinkert

  • Cc nikolaus.ehrenfeuchter@… added

Per this ome-users thread, it likely also makes sense to review the OMERO importer code base for usage of File.isHidden() once this is resolved in Bio-Formats.

comment:4 Changed 9 years ago by mlinkert

  • Milestone changed from 5.1.1 to 5.1.2

Some progress has been made on this in 5.1.0, and we now have the CI infrastructure to fully test on Windows. Pushing to 5.1.2 as part of https://trello.com/c/l9k0Zon4/199-bio-formats-windows

comment:5 Changed 9 years ago by mlinkert

  • Milestone changed from 5.1.4 to 5.x

comment:6 Changed 8 years ago by jamoore

  • Milestone changed from 5.x to Unscheduled

Changed 7 years ago by mlinkert

performance test case for File.isHidden alternatives

comment:7 Changed 7 years ago by mlinkert

  • Resolution set to fixed
  • Status changed from new to closed

Test case with several alternatives attached. When run on Windows with a file on a local disk:

java.io.File total time (10000)  calls: 148 ms
java.io.File avg time per call: 0.0148 ms
java.nio.file.Files total time (10000)  calls: 218 ms
java.nio.file.Files avg time per call: 0.0218 ms
dos:hidden total time (10000)  calls: 223 ms
dos:hidden avg time per call: 0.0223 ms
FileInputStream total time (10000)  calls: 1036 ms
FileInputStream avg time per call: 0.1036 ms
Apache Commons VFS total time (10000)  calls: 1598 ms
Apache Commons VFS avg time per call: 0.1598 ms

and when run on the same system, with the same file copied to a network disk:

java.io.File total time (10000)  calls: 14440 ms
java.io.File avg time per call: 1.444 ms
java.nio.file.Files total time (10000)  calls: 14755 ms
java.nio.file.Files avg time per call: 1.4755 ms
dos:hidden total time (10000)  calls: 14372 ms
dos:hidden avg time per call: 1.4372 ms
FileInputStream total time (10000)  calls: 136307 ms
FileInputStream avg time per call: 13.6307 ms
Apache Commons VFS total time (10000)  calls: 44687 ms
Apache Commons VFS avg time per call: 4.4687 ms

Closing as I don't have any further ideas, but feel free to reopen if there are concrete suggestions for other things to try.

Note: See TracTickets for help on using tickets. You may also have a look at Agilo extensions to the ticket.

1.3.13-PRO © 2008-2011 Agilo Software all rights reserved (this page was served in: 0.125081 sec.)

We're Hiring!