JDK-4911240 : Reduce init time for Java2D rendering
  • Type: Bug
  • Component: client-libs
  • Sub-Component: 2d
  • Affected Version: 5.0
  • Priority: P4
  • Status: Closed
  • Resolution: Won't Fix
  • OS: windows_nt
  • CPU: x86
  • Submitted: 2003-08-22
  • Updated: 2014-07-14
  • Resolved: 2014-07-14
Related Reports
Relates :  
Relates :  
Description
In a recent startup performance analysis, the initialization of the
rendering infrastructure for Java2D appeared to take up a large percentage
(about 13%) of the overall startup time for a simple AWT app.  This time
was spent setting up various elements of the Java2D rendering engine,
such as:
- registering native loops
- registering Java loops
- creating SurfaceData and SurfaceType structures
- creating various PixelFor classes
- setting up default loops and pipes

If we can reduce this time, it could have a large impact on overall startup time for all applications.

Here is the simple AWT app for testing:

------- StartupTest.java --------

import java.awt.Frame;
import java.awt.Graphics;
import javax.swing.JFrame;

public class StartupTest {
    public static void main(String args[]) {
	for (int i = 0; i < args.length; ++i) {
	    if (args[i].equals("-awt")) {
		Frame f = new AwtFrame();
		f.setSize(300, 300);
		f.setVisible(true);
	    } else if (args[i].equals("-swing")) {
		JFrame f = new SwingFrame();
		f.setSize(300, 300);
		f.setVisible(true);
	    }
	}
    }
}

class AwtFrame extends Frame {
    public void paint(Graphics g) {
	System.exit(0);
    }
}

class SwingFrame extends JFrame {
    public void paint(Graphics g) {
	System.exit(0);
    }
}

Comments
EVALUATION There is probably some fat to be trimmed in our current startup code but the total time taken by the indicated operations (registering our many graphics loops) is low enough on an absolute scale that most apps would benefit far more from optimizations to rendering overhead and throughput than by reducing the registration times. We may take a look at optimizing this mechanism in the Tiger timeframe, but we are first going to target the rendering itself. ###@###.### 2003-09-15
15-09-2003