Dmitry Malykhanov wrote:
> 
> Hmm, I'm not expert in swing. Actually I'm just playing with swing-0.7
> (very old distribution, right?). Mostly running examples and trying to
> modify them. But today I download swing-1.0.3 and found following feature.
> Image output speed during image loading (in SwingSet example, ScrollePane
> component) is *extremely* slow even when I using TYA JIT compiler. After
> image had decoded everything works fine with usual speed. So, I'm a bit
> confused with this "feature" too.

I crufted up an example; I tested it under Swing 1.0.2 (didn't even know
1.0.3 was out...) 

http://www.partnersoft.com/~reavis/java/SlowImageLoadExample.zip

The results are interesting. Here's the readme:

This here is an example of my problem with Swing image loading under the
linux-jdk.
It seems to manifest at its worst when drawing lots of images, so I
provided
one image and a little perl scriptie that makes about 30 hard links to
it; this
hopefully fools the java runtime into thinking they are separate image
files.

Compile the two files - AWTImageLoad.java and SwingImageLoad.java.
Notice that
the only difference between them is that the AWT one uses a Canvas for 
the drawing and the Swing one uses a JPanel. I also turned off
double-buffering
on the swing one (this doesn't seem to affect the bug, but presumeably
makes
things more egalitarian). 

Run them. I'm assuming you have the compiled classes in your classpath
somewhere:

java AWTImageLoad *.gif
java SwingImageLoad *.gif

Don't touch the mouse during the runs. Watch the repaint counter - 
the AWT one finishes in less than 100 repaints on my machine, and
never hangs. The Swing one takes several _thousand_ repaints, and
hangs frequently - once at about 340; once at around 760; etc. Moving
the mouse or hitting a key starts it painting again. 
Regardless, it takes forever to complete.

So the big question is: is this a Swing bug, or a Java-Linux bug? I
don't
see this behavior under Win32, which is why I'm pestering java-linux.

-- 

Paul Reavis                                      [EMAIL PROTECTED]
Design Lead
Partner Software, Inc.                        http://www.partnersoft.com

Reply via email to