Skip to main content

[JAI-IMAGEIO] Poor application performance after installing JAI Image IO onWin2k.

8 replies [Last post]
Anonymous

Forgive the atrociously ambiguous subject as a major part of the problem
is I'm having a great deal of trouble figuring out what the source of
the problem is. I'll try to keep it as brief and relevant as possible.

I'm working on an application that uses Image I/O to load PNG, JPEG and
GIF images for the Swing GUI. This works fine on my development machine
and several other testing machines which are Win2k and WinXP boxes. I
also need to work with TIF images and was using JAI (e.g. "fileload").
Recently I moved that over to use JAI ImageIO and it has worked fine on
my development (Win2k) machine and in fact has (for a reason I don't
understand) resulted in faster painting. That works fine both when
launched from IntelliJ and when using it in a standalone version on that
same machine.

Unfortunately I'm having serious problems on the other testing
machines. Without JAI ImageIO installed on these machines the
application works fine but (obviously) trying to use the TIF
capabilities results in errors. However, when I install the latest JAI
ImageIO /release/ (1.0_01) and try to run the application I have
problems. First, the GUI is very slow and non-responsive and I see a
constant 90%+ CPU usage for the application. I haven't been able to
ascertain whether or not this is because painting the GUI (the main
background is a large JPEG loaded through ImageIO) or if the GUI is slow
because something else is hogging the CPU. Furthermore, when trying to
do something with the application I get an exception:

javax.imageio.IIOException: codecLib error
at
com.sun.media.imageioimpl.plugins.png.CLibPNGImageReader.decode(CLibPNGImageReader.java:46)
at
com.sun.media.imageioimpl.plugins.clib.CLibImageReader.getImage(CLibImageReader.java:320)
at
com.sun.media.imageioimpl.plugins.png.CLibPNGImageReader.getRawImageType(CLibPNGImageReader.java:82)
at
com.sun.media.imageioimpl.plugins.clib.CLibImageReader.read(CLibImageReader.java:380)
at javax.imageio.ImageIO.read(Unknown Source)
at javax.imageio.ImageIO.read(Unknown Source)
at (removed -- it's our code trying to load a PNG)
Caused by: com.sun.medialib.codec.png.PNGException:
codecLib: general png error.
at com.sun.medialib.codec.png.Decoder.decode(Decoder.java:163)
at
com.sun.media.imageioimpl.plugins.png.CLibPNGImageReader.decode(CLibPNGImageReader.java:44)
... 12 more

To be clear this portion of the code works fine and the PNG is loaded
and displayed if JAI ImageIO is not installed. I've tried using 1.1
beta too to see if the issue was resolved but it persisted and was in
fact /worse/. Obviously I doubt you're going to be able to tell me what
the issue is from the information I've supplied but hopefully you may
have some guidance on how to go about finding the problem and sending
you any information/images you need if it is an issue with JAI ImageIO.

Thanks,
Ken Blair

P.S. On the machines with the issue I've tried using both a standalone
build using an executable JAR and using our JWS version. I have
identical issues with both.

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@jai-imageio.dev.java.net
For additional commands, e-mail: interest-help@jai-imageio.dev.java.net

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
James Cheng

Hi Ken,

> Should I file an issue, e-mail someone the test case or is there more
> testing you'd like me to do?

Filing an issue is always a good idea and very much appreciated.

Thanks,
-James

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@jai-imageio.dev.java.net
For additional commands, e-mail: interest-help@jai-imageio.dev.java.net

Ken Blair

James Cheng wrote:
> Hi Ken,
>
>> Should I file an issue, e-mail someone the test case or is there more
>> testing you'd like me to do?
>
> Filing an issue is always a good idea and very much appreciated.
>
> Thanks,
> -James
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: interest-unsubscribe@jai-imageio.dev.java.net
> For additional commands, e-mail: interest-help@jai-imageio.dev.java.net
>
Submitted as issue #81. For now I'll just use the JAR files alone. Thanks.

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@jai-imageio.dev.java.net
For additional commands, e-mail: interest-help@jai-imageio.dev.java.net

Brian Burkhalter

On Wed, 9 Aug 2006, Ken Blair wrote:

> Submitted as issue #81. For now I'll just use the JAR files alone. Thanks.

As an alternative you can disable the native libraries by setting the property
com.sun.media.imageio.disableCodecLib to true as described in the javadoc
overview here

http://download.java.net/media/jai-imageio/javadoc/1.1-beta/index.html

Brian

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@jai-imageio.dev.java.net
For additional commands, e-mail: interest-help@jai-imageio.dev.java.net

James Cheng

Hi Ken,

> Caused by: com.sun.medialib.codec.png.PNGException:
> codecLib: general png error.
> at com.sun.medialib.codec.png.Decoder.decode(Decoder.java:163)

This appears to be a problem of the codecLib PNG decoder. Can you
provide a PNG image that causes this exception? Either send it to
me via private email, or preferably file an issue and attach the
image to it, at your convenience?

As for the overall performance issue, you might like to compare the
configuration of your development Win2k machine and that of the
other testing machines, such as CPU, RAM, JDK, ...

You might also like to narrow the performance issue down to one or
two readers/writers, by picking individual reader/writer from
different packages on the fly.

Since your application loads large JPEG images, it might be affected
by this bug, which has been fixed in 1.1-beta:

http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5094376

HTH,
-James

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@jai-imageio.dev.java.net
For additional commands, e-mail: interest-help@jai-imageio.dev.java.net

Ken Blair

James Cheng wrote:
> This appears to be a problem of the codecLib PNG decoder. Can you
> provide a PNG image that causes this exception? Either send it to
> me via private email, or preferably file an issue and attach the
> image to it, at your convenience?
I was actually just finishing up a self-contained test case in an
executable JAR with the image when I received this. I've created an
issue (#80 in core tracker) with the JAR attached.
> As for the overall performance issue, you might like to compare the
> configuration of your development Win2k machine and that of the
> other testing machines, such as CPU, RAM, JDK, ...
The problem with that is it works perfectly fine when JAI ImageIO is not
installed. I'm working on a simple test case to try and show the
difference in performance I'm seeing between the J2SE core and JAI
ImageIO. I'm talking about something as simple as having loaded a JPEG
and painting it on the screen which is vastly slower when JAI ImageIO is
installed.
> Since your application loads large JPEG images, it might be affected
> by this bug, which has been fixed in 1.1-beta:
>
> http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5094376
That could certainly be the problem or related to the problem. I will
be doing more testing and try to isolate the issue to either rule out
JAI ImageIO as the culprit or produce a test case you can use to find
the issue. However, as I said before I tested this with 1.1-beta too
and had the same issue.

Thanks,
Ken Blair

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@jai-imageio.dev.java.net
For additional commands, e-mail: interest-help@jai-imageio.dev.java.net

James Cheng

Hi Ken,

> I was actually just finishing up a self-contained test case in an
> executable JAR with the image when I received this. I've created an
> issue (#80 in core tracker) with the JAR attached.

Thanks for taking your time to file the issue.

> The problem with that is it works perfectly fine when JAI ImageIO is not
> installed. I'm working on a simple test case to try and show the
> difference in performance I'm seeing between the J2SE core and JAI
> ImageIO. I'm talking about something as simple as having loaded a JPEG
> and painting it on the screen which is vastly slower when JAI ImageIO is
> installed.

Loading extra .jar and .dll takes some time, in a range of 50ms to
300ms as shown in my test. It's a one-time overhead, so it's not a
problem for a long run process.

The extra .jar and .dll take some memory as well, so I wonder whether
increasing heap size (-Xmx) would help.

Thanks,
-James

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@jai-imageio.dev.java.net
For additional commands, e-mail: interest-help@jai-imageio.dev.java.net

Ken Blair

James Cheng wrote:
> Loading extra .jar and .dll takes some time, in a range of 50ms to
> 300ms as shown in my test. It's a one-time overhead, so it's not a
> problem for a long run process.
>
> The extra .jar and .dll take some memory as well, so I wonder whether
> increasing heap size (-Xmx) would help.
I downloaded the classpath installation of 1.0_01 and added the JAR
files to my classpath but didn't use the DLL and had no problem.
Furthermore, I compiled a test case to simply display a 92.5 KB JPEG in
a JFrame using JLabel and an ImageIcon constructed from a BufferedImage
returned by ImageIO.read(URL) and have experienced the exact same
problem on two machines I tested it on.

One machine is running Windows 2000 with a 733mhz P3 and 384mb of RAM.
The other is a Windows XP SP2 machine with two 3.2ghz Xeon processors
and 2gb of RAM. Both are running Java 1.5. On both machines when
running the test case the image was displayed quickly and the GUI was
fast and responsive /without/ JAI ImageIO installed. I then installed
JAI ImageIO 1.0_01 using the JRE installer for Windows from the java.net
site. Running the test case after the install resulted in a slightly
slower startup time and was /extremely/ slow painting with a very
sluggish GUI. I was comparing responsiveness by dragging scrollbars to
move around the image and by covering portions of the frame with another
window and then uncovering it to see how fast the GUI would repaint.

So, I don't know what the deal is and it's entirely possible that it's
some vague configuration issue over here. However, the test case is
using nothing but the J2SE core API and I get the exact same results on
two vastly different machines. I'll go try 1.1-beta next and see if
it's any different but when I tried that with my application it was
/worse/. As I said before, if I download the classpath installation and
only add the JARs to the classpath everything works fine as far as I can
tell and there doesn't seem to be any performance issues.

Should I file an issue, e-mail someone the test case or is there more
testing you'd like me to do?

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@jai-imageio.dev.java.net
For additional commands, e-mail: interest-help@jai-imageio.dev.java.net

Ken Blair

1.1-beta is in fact much worse, to the point that the frame shows up and
nothing in the frame gets painted and the program is completely
non-responsive, taking 60+ seconds to exit after hitting the close
button on the frame. Deleting clib_jiio.dll from the Java
installation's bin directory fixes the problem.

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@jai-imageio.dev.java.net
For additional commands, e-mail: interest-help@jai-imageio.dev.java.net