Skip to main content

reading files - slow performance?

2 replies [Last post]
Joined: 2006-10-05

hi, i'm making an applet with a filesystem jtree and a jpanel where thumbnails for pics in a directory are displayed.

i'm using Image img = File(file));
and then scaling with jai.

i have a directory with ~20 1 to 2 mbs jpegs (2000x1700).

this dir takes like 30 sec or more to display its thumbnails.

i printlned time in milliseconds after each read and scaling.

scaling takes about 200millis, this is not really my concern, but reading takes 500millis.

so... what's going on? :)

should it take half a second to read a 1.5 mb jpeg? i don't think so..

or maybe... should i use multithreading? which of course i know nothing about.. i'm 2 weeks java old :)

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2006-11-16

I am,too.
If you know,Please mail to me.

Thank advance.

Joined: 2004-07-23

Take a look at the Java nio (New IO) classes that were introduced in 1.4. Unless you are using an ancient JVM, then you should write you apps to take advantage of the performance gains of the new classes.

Here are a few links:

Also, try a Google search on "Java nio" and you'll find a lot of information.