My app scans part of a file system, and my users reported it was very slow when they were scanning a network drive. Testing my code, I identified the bottleneck: the methods File.isFile(), File.isDirectory(), and File.isHidden(), which are all calling fs.getBooleanAttributes(File f). This method appears to be very slow on Windows network drives. How can I improve performance? Can I avoid calling this method in some way?
My app scans part of a file system, and my users reported it was
Share
How are you building this file list? Unless you are displaying every file on the system at the same time, you should have some options…
Perhaps if you show the code you are using to build the list, we could find some other areas of improvement. (Why can’t you just infer the type based on the method used to gather the information? If you’re calling a method like GetFiles() don’t you already know that everything returned is a file?)