Bug 92199 - Unusually bad performance for JPG image loading
Summary: Unusually bad performance for JPG image loading
Status: RESOLVED DUPLICATE of bug 24451
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Carolyn MacLeod CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-04-21 06:01 EDT by Daniel Krügler CLA
Modified: 2005-04-26 15:05 EDT (History)
6 users (show)

See Also:


Attachments
Example image (117.82 KB, image/jpeg)
2005-04-21 06:03 EDT, Daniel Krügler CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Krügler CLA 2005-04-21 06:01:08 EDT
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
Comment 1 Daniel Krügler CLA 2005-04-21 06:03:14 EDT
Created attachment 20177 [details]
Example image

The provided jpg file may be used as an example.
Comment 2 Steve Northover CLA 2005-04-21 09:42:26 EDT
Thanks Daniel!

CAR to build a benchmark using the jpg and investigate.
Comment 3 Billy Biggs CLA 2005-04-25 17:05:51 EDT
Is this the same as bug 24451?
Comment 4 Daniel Krügler CLA 2005-04-26 03:27:15 EDT
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.
Comment 5 Carolyn MacLeod CLA 2005-04-26 13:31:18 EDT
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 ***
Comment 6 Steve Northover CLA 2005-04-26 14:38:17 EDT
CAR, make sure you move the image over to the other bug.
Comment 7 Carolyn MacLeod CLA 2005-04-26 15:05:10 EDT
Done.