On Apr 30, 2005, at 10:26 AM, Dmitry Markman wrote:
we have very complex molecular dynamic simulations
and I can not see any thing close to 10% of 1.3.1 slowness
The operant term may be "complex". Do you
- have a high think to draw ratio?
- draw every frame, or allow for buffering?
Java 1.4.2 is very _very_ slow at drawing. Here's an example: on my
Powerbook, 1.3.1 draws this at 4 times the speed of 1.4.2. On my dual
G5 I get an even more pronounced difference, though that is largely due
to my graphics card. Notice that 1.4.2 bulks up drawing into chunks
and then spits them out. If you force individual drawing it's rather
more pronounced (not with Toolkit.sync() though, which has excessive
overhead in 1.3.1). In other graphics contexts we see an even more
pronounced difference. With out thinktime overhead, we're seeing 1.4.2
run at about 1/3 the speed of 1.3.1 for our programs even though 1.4.2
has a faster VM. Apple promised us they'd fix this in Tiger. Can
anyone verify?
import java.awt.event.*;
import java.util.*;
import javax.swing.*;
import java.awt.*;
public class Example
{
public static void main(String[] args)
{
System.setProperty("com.apple.hwaccel","true");
final JFrame f = new JFrame("Example");
f.setSize(400,400);
JButton b = new JButton("Press Me");
f.getContentPane().add(b,BorderLayout.NORTH);
f.show();
b.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
Random r = new Random();
Graphics2D g =
(Graphics2D)(f.getContentPane().getGraphics());
RenderingHints hints = new
RenderingHints(RenderingHints.KEY_RENDERING,
RenderingHints.VALUE_RENDER_SPEED);
hints.put(RenderingHints.KEY_INTERPOLATION,RenderingHints.VALUE_INTERPOL
ATION_NEAREST_NEIGHBOR);
hints.put(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_OFF);
hints.put(RenderingHints.KEY_TEXT_ANTIALIASING,
RenderingHints.VALUE_TEXT_ANTIALIAS_OFF);
hints.put(RenderingHints.KEY_ALPHA_INTERPOLATION,RenderingHints.VALUE_AL
PHA_INTERPOLATION_SPEED);
g.setRenderingHints(hints);
g.setColor(new
Color(r.nextInt(256),r.nextInt(256),r.nextInt(256)));
long l = System.currentTimeMillis();
for(int x=0;x<10000;x++)
g.drawLine(r.nextInt(400),r.nextInt(400),
r.nextInt(400),r.nextInt(400) );
System.out.println(System.currentTimeMillis() - l);
}
});
}
}
Sean
_______________________________________________
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