Forums » User questions »
Http directory listing details performance
Added by Hajnal Akos over 11 years ago
Dear developers,
HTTP dir listing works fine, but it becomes very slow when the number of entries is over 200,
and now I am very curious why is that...
First, I get the entry names, which is fast:
List<URL> files = new Vector<URL>(); NSDirectory dir = NSFactory.createNSDirectory(URLFactory.createURL(myurl), Flags.READ.getValue()); List<URL> dirContent = dir.list("*"); for (URL name: dirContent) if (dir.isEntry(name)) files.add(URLFactory.createURL("" + dir.getURL() + name)); dir.close(); // I close it
then I get file details:
for (int i = 0; i < files.size(); i++) { File f = FileFactory.createFile(files.get(i)); long size = f.getSize(); SimpleDateFormat sdf = new SimpleDateFormat("dd-MMM-yyyy HH:mm"); String date = sdf.format(new Date(f.getMTime())); f.close(); // I close it System.out.println(i + " " + files.get(i) + " " + date + " " + size + "B "); }
Getting details sometimes stops for seconds for some files (as I saw, regardless of its size), and getting a dir with 1000 elements took 5 minutes or longer.
I also see that there are many open HTTP connections to the web server. Could it be because used ports are released in spite of the close? Or any other ideas?
Thank you in advance.
Regards,
Akos Hajnal
ps. I use 0.9.16-SNAPSHOT
Replies (2)
RE: Http directory listing details performance
-
Added by Schwarz Lionel over 11 years ago
Hi Akos,
our test suite does not contain a large number of files. I am currently testing it and I'll let you know later on.
Regards
Lionel
RE: Http directory listing details performance
-
Added by Hajnal Akos over 11 years ago
Thank you, the new snapshot shows 26x speedup on my computer.
The performance is completely acceptable now.
Regards, Akos