From: Roedy Green on
Has anyone looked inside File.list to see how the native method is
implemented on Windows?

I notice it that my own File.list code to scan directories seems to
run considerably slower than C utilities, e.g. looking for junk files
to delete. The hard disk also seem to "buzz" as if doing many small
seeks when in runs my code.

I have my hard disk well defragged with the most of the directories
contiguous and lumped together to make such scanning efficient.

I also notice that Take Command, which maintains a simple flat file
mirror listing all the directories on disk can find scan for a string
and jump to a directory ever so much faster than java can scan.

I am wondering if this is just the nature of Java-OS mismatched
impedance, or there is something that could be done to speed up
File.list. It is doing anything stupid?

--
Roedy Green Canadian Mind Products
http://mindprod.com

If you tell a computer the same fact in more than one place, unless you have an automated mechanism to ensure they stay in sync, the versions of the fact will eventually get out of sync.
From: Spud on
Roedy Green wrote:
> Has anyone looked inside File.list to see how the native method is
> implemented on Windows?
>
> I notice it that my own File.list code to scan directories seems to
> run considerably slower than C utilities, e.g. looking for junk files
> to delete. The hard disk also seem to "buzz" as if doing many small
> seeks when in runs my code.
>
> I have my hard disk well defragged with the most of the directories
> contiguous and lumped together to make such scanning efficient.
>
> I also notice that Take Command, which maintains a simple flat file
> mirror listing all the directories on disk can find scan for a string
> and jump to a directory ever so much faster than java can scan.
>
> I am wondering if this is just the nature of Java-OS mismatched
> impedance, or there is something that could be done to speed up
> File.list. It is doing anything stupid?
>

I noticed that JDK 1.7 is supposed to have directory iterators that load
directory entries in a lazy way. You might poke around in that code.
From: Christian on
Would be interesting if you measured if FileSystemView.getFiles()
performs different from file.listFiles().


Christian
From: John B. Matthews on
In article <hp79la$gb$1(a)online.de>, Christian <fakemail(a)xyz.de> wrote:

> Would be interesting if you measured if FileSystemView.getFiles()
> performs different from file.listFiles().

Interesting. "Java Licensees may want to provide a different
implementation of FileSystemView to better handle a given operating
system."

<http://java.sun.com/javase/6/docs/api/javax/swing/filechooser/FileSystemView.html>

This thread examines some memory related issues regarding
FileSystemView.getFileSystemView():

<http://groups.google.com/group/comp.lang.java.programmer/browse_frm/thread/16d16e4f9b7d9509>

This related study was recently updated:

<http://sites.google.com/site/trashgod/garbageheap>

--
John B. Matthews
trashgod at gmail dot com
<http://sites.google.com/site/drjohnbmatthews>
From: Christian on
Am 03.04.2010 20:48, schrieb John B. Matthews:
> In article <hp79la$gb$1(a)online.de>, Christian <fakemail(a)xyz.de> wrote:
>
>> Would be interesting if you measured if FileSystemView.getFiles()
>> performs different from file.listFiles().
>
> Interesting. "Java Licensees may want to provide a different
> implementation of FileSystemView to better handle a given operating
> system."
>
> <http://java.sun.com/javase/6/docs/api/javax/swing/filechooser/FileSystemView.html>
>
> This thread examines some memory related issues regarding
> FileSystemView.getFileSystemView():
>
> <http://groups.google.com/group/comp.lang.java.programmer/browse_frm/thread/16d16e4f9b7d9509>
>
> This related study was recently updated:
>
> <http://sites.google.com/site/trashgod/garbageheap>
>

It would be good to cache the FileSystemView object... as it does some
packratting...
also in earlier 1.6.x versions of the jre windows simplementation the
FileSystemView.getFiles() leaked memory ...
though thats fixed by now...