Community
Participate
Working Groups
I observered remarkable bad performance of org.eclipse.swt.graphics.ImageData loading JPG images. E.g. an ~120 kB JPG file (1455 x 1604 Pixels, 16,7 Millions colors (24 BitsPerPixel)) needs several **seconds** for just the single line Image img = new Image(getDisplay(), getFileName()); The lack of performance does not depend whether the image is already in memory or loaded from other locations (e.g. file). Simple debugging shows, that the bottleneck seems to be located during operation in org.eclipse.swt.internal.image.JPEGFileFormat.loadFromByteStream(), i.e. even an in-memory file provided by the example final byte[] data = ..; // Get image data final InputStream is = new ByteArrayInputStream(data); try { final ImageData imgData = new ImageData(is); // bottle neck!! final ImageDescriptor d = ImageDescriptor.createFromImageData(imgData); fMyImage = d.createImage(true); } finally { is.close(); } from newsgroup contribution "Inefficient image loadings?" in eclipse.platform.swt. Daniel Krügler
Created attachment 20177 [details] Example image The provided jpg file may be used as an example.
Thanks Daniel! CAR to build a benchmark using the jpg and investigate.
Is this the same as bug 24451?
After reading bug 24451 I think, that this report matches by own observations. To my opinion the performance lack has nothing to do with VM memory. Using the mentioned ImageViewer plugin as an example the bottle neck is not influenced by increasing available memory (I used up to -Xmx512m on a 1 GB Win2k system). My test case was using a 1.5.0_02 JRE.
I'm going to mark this as a duplicate of bug 24451 so that they can be looked at together. I got your image and tried to open it with the SWT ImageAnalyzer example, and I got an OutOfMemoryError. So I'm going to start by looking at that, then I'll break out the profiler and look at our image loading code in detail. Thanks! *** This bug has been marked as a duplicate of 24451 ***
CAR, make sure you move the image over to the other bug.
Done.