Project: SWT
Bug 142335 Perf Fix for: org.eclipse.swt.internal.image.PngHuffmanTable.generateTable
Reported: 2006-05-17 16:17:22 | Status: closed fixed

org.eclipse.swt.internal.image.PngHuffmanTable.generateTable has a bubble sort of the Huffman table in the top of the routine. Profiling an application opening a window with a moderate number of PNG images (around a dozen) shows this method to be accounting for 43% of the the instructions executed in the open window scenario. Changing the code to sort via java.util.Arrays.sort() results in reducing the instruction counts for this method to less than 5% of the scenario total. (email me if you want the chaged code) For the specfic scenario I'm looking at (window w/ about a dozen PNGs) the improved code is noticeably (to an end user) quicker.

Files changed in fix:
bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/PngHuffmanTable.java