Performance improvements in Substance 5

April 30th, 2008

Looking at the comments on the announcement of release 4.3 of Substance look-and-feel, the three major pain points for the users are: performance, performance and performance. You made your statement very clear, and performance improvements were placed as the top priority for the next release (code named Substance 5).

Those of you who visit the Java2D forum on java.net might have seen the discussion between myself and Dmitri Trembovetski, one of Sun’s engineers working on Java2D team. Dmitri has been kind enough to analyze the tracing metrics of Substance, providing very valuable tips on improving the rendering performance. I have been quite busy for the last two weeks working on nothing but the performance area in Substance 5, and i’m very pleased to share the initial results with you.

Substance distribution includes a test application that uses all core Swing controls, checking quite a few scenarios (toolbars embedded in toolbars would be such an example from a real bug report submitted by a user). The distribution also includes a performance suite that selects a few representative tabs in this application (buttons, toggle buttons, check boxes, radio buttons, comboboxes, sliders, table with different renderers; application menu bar, tool bar and tabs are always present). In order to measure the performance, this test frame is rendered to an offscreen image, allowing the look-and-feel to cache all the relevant images (first 10 iterations) and then timing the subsequent iterations.

Here are the results for Substance 4.3 (latest stable release) as compared with native Windows look-and-feel, Nimbus and Plastic3D from JGoodies on a dual-core Vista machine running b22 of 6u10:

  • Plastic3D – 34ms with 10.527 KB used heap space
  • Windows – 56ms with 10.290 KB used heap space
  • Nimbus – 66ms with 25.796 KB used heap space
  • Substance – 194ms with 23.353 KB used heap space

As you can see, Substance 4.3 is almost three times slower than Nimbus and 3.5 times slower than Windows look-and-feel.

And these are the results under the latest development drop of Substance 5:

  • Plastic3D – 34ms with 10.527 KB used heap space
  • Substance – 52ms with 18.549 KB used heap space
  • Windows – 56ms with 10.290 KB used heap space
  • Nimbus – 66ms with 25.796 KB used heap space

As you can see, version 5.0 is 3.7 times faster than version 4.3, even edging out Windows and Nimbus. It also uses less memory than before (by about 20%) and starts around twice faster. The same range of numbers is observed on a single-CPU Windows XP and Ubuntu 8.04 (running the same b22 of 6u10). The numbers above are for the Autumn skin. Similar improvements are recorded for other core Substance skins, such as Business Black Steel (from 220ms to 73ms), Creme (207ms to 62ms) and Nebula (222ms to 73ms), staying around 3 to 3.7 faster than the previous release.

The next entry will talk more about the specific optimizations that contributed to the performance improvements. You are more than welcome to take the latest dev drop and test it on your applications. There are some minor color inconsistencies on colorized combo boxes, but other than that it should be quite stable and fast.

Note that this is very much work in progress. While all of the current measurements are taken on the software pipeline (still more places left to be optimized), and there is a lot of work to be done for hardware-accelerated pipelines (D3D). The performance suite will be used throughout the development of this version to make sure that there is no performance regression. It will also serve to create guidelines for designing fast custom skins for Substance. Stay tuned for more.