Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Major graphics performance regression in latest Java bump



Test machine: Dual PowerMac G5, GeForce FX 5200, java build 1.5.0.16-b06-284

Below is a chunk of code which demonstrates a major graphics performance regression on this machine between Java 1.4.2 and the latest Java 1.5. It appears that the choice of Sun renderer is ignored. I have reason to believe this is due to recent changes in 1.5; on my (Intel MacBook), without the latest upgrade to 1.5, I've seen no regression yet. I'd compare to the newest upgrade on the Macbook, but it's my primary machine and I'm scared to update to this _huge_ drop in performance.

The code draws a bunch of fillrects, then prints out the time to do so. In 1.5.0_16, it takes about 8 seconds. In 1.4.2, it takes about 4 seconds. I believe other primitives (circles, etc.) are even worse. Stretching an image may be _much_ worse. No modifications to rendering hints, properties, etc., appears to have any effect

Can anyone else verify this on another kind of machine? I'm hoping for some data points before tossing the bug report into Apple's bug-reporter black hole.

Sean


import javax.swing.*; import java.awt.*;

public class Foo extends JComponent
    {
    public static void main(String[] args)
	{
	/*   /// None of this makes any difference
	
	System.setProperty("com.apple.hwaccel","true");
	System.setProperty("com.apple.graphics.EnableQ2DX","true");
	System.setProperty("com.apple.graphics.EnableDeferredUpdates",
			   "false");
	System.setProperty("com.apple.graphics.UseQuartz","true");
	*/

	JFrame frame = new JFrame();
	frame.getContentPane().setLayout(new BorderLayout());
	final Foo foo = new Foo();
	frame.getContentPane().add(foo, BorderLayout.CENTER);
	frame.setSize(500,500);
	frame.setVisible(true);
	final Runnable blocker = new Runnable() {public void run(){}};
	
	new Thread(new Runnable() { public void run()
		{
		while(true)
		    {
		    foo.repaint();
		    try { SwingUtilities.invokeAndWait(blocker); }
			catch (Exception e) { }
		    }
		}}).start();
	}

    RenderingHints hints = null;
    public Foo()
	{
	hints = new RenderingHints(RenderingHints.KEY_RENDERING,
	    RenderingHints.VALUE_RENDER_SPEED);
	hints.put(RenderingHints.KEY_ANTIALIASING,
	    RenderingHints.VALUE_ANTIALIAS_OFF);
	}

    int b = 0;
    long lastTime = System.currentTimeMillis();
    public void paintComponent(Graphics g)
	{
	b++;
	if (b >= 256)
	    {
	    long time = System.currentTimeMillis();
	    System.out.println(time - lastTime);
	    lastTime = time;
	    b = 0;
	    }
	// this makes little difference
	// ((Graphics2D)g).setRenderingHints(hints);

	g.setColor(new Color(b,b,b));
	int w = getWidth();
	int h = getHeight();
	for(int x=0;x<w;x+=10)
	    for(int y=0;y<h;y+=10)
		g.fillRect(x,y,9,9);
	}
    }

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.