-
Bug
-
Resolution: Duplicate
-
P4
-
None
-
1.2.0
-
generic
-
solaris_2.6
Underlined text is extremely slow when displayed on a nonlocal host.
Can be demonstrated by:
1) set DISPLAY environment variable to a different host than the one running
the virtual machine.
2) Use hotjava and go to URL: http://www.yahoo.com
3) fields that are not underlined text are displayed quickly, those that
are underlined take about a second each on a 167Mz Ultra.
this problem can be easily demonstarted by the following test program,
it shows drawing can be 200 times faster in 1.1 than 1.2-FCS-L ( on local XServer), and 1500 times faster in 1.1 than 1.2 (on remote XServer)
/*
* SlowText.java
*
* Copyright (c) 1996 Sun Microsystems, Inc. All Rights Reserved.
*
*/
import java.applet.*;
import java.awt.*;
import java.io.*;
import java.net.*;
import java.util.*;
import java.awt.event.*;
public class SlowText extends Frame implements WindowListener,
ComponentListener, ActionListener {
Container cc;
public SlowText() {
super();
}
public void addNotify() {
super.addNotify();
}
public static void main(String args[]) {
String str;
DrawPanel p;
SlowText frame = new SlowText();
frame.setSize(400,400);
frame.addWindowListener ( frame );
frame.addComponentListener ( frame );
if ( args.length > 0 )
frame.setMenuBar(new MenuBar());
frame.setLayout(new BorderLayout());
p = new DrawPanel();
frame.add( p );
frame.invalidate();
frame.setVisible(true);
}
public void windowClosing( WindowEvent e ) {
System.exit(0);
}
public void update( Graphics g ) {
super.update(g);
}
public void paint( Graphics g ) {
super.paint(g);
}
public void actionPerformed (ActionEvent evt) {
Object bsrc = evt.getSource();
}
public void componentResized(ComponentEvent c) {
}
public void componentMoved(ComponentEvent c) {
}
public void componentShown(ComponentEvent c) {
}
public void componentHidden(ComponentEvent c) {
}
public void windowOpened(WindowEvent e) {
}
public void windowClosed(WindowEvent e) {
}
public void windowIconified(WindowEvent e) {
}
public void windowDeiconified(WindowEvent e) {
}
public void windowActivated(WindowEvent e) {
}
public void windowDeactivated(WindowEvent e) {
}
}
class DrawPanel extends Panel {
static int counter=0;
long t1, t2, min, sec, fraction;
public void setBounds(int x, int y, int w, int h ) {
super.setBounds(x,y,w,h);
}
public void paint( Graphics gc )
{
int r,g,b;
int w, h;
int x1, y1, x2, y2;
int start, increment;
int END=32;
t1 = System.currentTimeMillis();
counter++;
Dimension size = getSize();
w = size.width;
h = size.height;
b = 0x0;
if ( ( counter & 1 ) == 0 ) {
start = 0;
increment = 1;
} else {
start=END-1;
increment=-1;
}
for ( r=start; (r >= 0 && r<END); r+=increment ) {
x1 = ( r * w ) / END;
x2 = ((r+1)*w) / END;
if ( x1 != x2 ) for ( g=0; g<END; g++ ) {
y1 = ( g * h ) / END;
y2 = ((g+1)*h) / END;
gc.setColor(getBackground());
gc.fillRect(x1, y1, x2-x1, y2-y1);
gc.setColor(getForeground());
gc.drawString("X", x1, y2);
}
}
t2 = System.currentTimeMillis();
min = (t2-t1)/(1000 * 60);
sec =((t2-t1)/1000) % 60;
fraction = (t2-t1) % 1000;
System.out.println("total time to paint: "+min+":"+sec+"."+fraction);
System.exit(0);
}
}
Can be demonstrated by:
1) set DISPLAY environment variable to a different host than the one running
the virtual machine.
2) Use hotjava and go to URL: http://www.yahoo.com
3) fields that are not underlined text are displayed quickly, those that
are underlined take about a second each on a 167Mz Ultra.
this problem can be easily demonstarted by the following test program,
it shows drawing can be 200 times faster in 1.1 than 1.2-FCS-L ( on local XServer), and 1500 times faster in 1.1 than 1.2 (on remote XServer)
/*
* SlowText.java
*
* Copyright (c) 1996 Sun Microsystems, Inc. All Rights Reserved.
*
*/
import java.applet.*;
import java.awt.*;
import java.io.*;
import java.net.*;
import java.util.*;
import java.awt.event.*;
public class SlowText extends Frame implements WindowListener,
ComponentListener, ActionListener {
Container cc;
public SlowText() {
super();
}
public void addNotify() {
super.addNotify();
}
public static void main(String args[]) {
String str;
DrawPanel p;
SlowText frame = new SlowText();
frame.setSize(400,400);
frame.addWindowListener ( frame );
frame.addComponentListener ( frame );
if ( args.length > 0 )
frame.setMenuBar(new MenuBar());
frame.setLayout(new BorderLayout());
p = new DrawPanel();
frame.add( p );
frame.invalidate();
frame.setVisible(true);
}
public void windowClosing( WindowEvent e ) {
System.exit(0);
}
public void update( Graphics g ) {
super.update(g);
}
public void paint( Graphics g ) {
super.paint(g);
}
public void actionPerformed (ActionEvent evt) {
Object bsrc = evt.getSource();
}
public void componentResized(ComponentEvent c) {
}
public void componentMoved(ComponentEvent c) {
}
public void componentShown(ComponentEvent c) {
}
public void componentHidden(ComponentEvent c) {
}
public void windowOpened(WindowEvent e) {
}
public void windowClosed(WindowEvent e) {
}
public void windowIconified(WindowEvent e) {
}
public void windowDeiconified(WindowEvent e) {
}
public void windowActivated(WindowEvent e) {
}
public void windowDeactivated(WindowEvent e) {
}
}
class DrawPanel extends Panel {
static int counter=0;
long t1, t2, min, sec, fraction;
public void setBounds(int x, int y, int w, int h ) {
super.setBounds(x,y,w,h);
}
public void paint( Graphics gc )
{
int r,g,b;
int w, h;
int x1, y1, x2, y2;
int start, increment;
int END=32;
t1 = System.currentTimeMillis();
counter++;
Dimension size = getSize();
w = size.width;
h = size.height;
b = 0x0;
if ( ( counter & 1 ) == 0 ) {
start = 0;
increment = 1;
} else {
start=END-1;
increment=-1;
}
for ( r=start; (r >= 0 && r<END); r+=increment ) {
x1 = ( r * w ) / END;
x2 = ((r+1)*w) / END;
if ( x1 != x2 ) for ( g=0; g<END; g++ ) {
y1 = ( g * h ) / END;
y2 = ((g+1)*h) / END;
gc.setColor(getBackground());
gc.fillRect(x1, y1, x2-x1, y2-y1);
gc.setColor(getForeground());
gc.drawString("X", x1, y2);
}
}
t2 = System.currentTimeMillis();
min = (t2-t1)/(1000 * 60);
sec =((t2-t1)/1000) % 60;
fraction = (t2-t1) % 1000;
System.out.println("total time to paint: "+min+":"+sec+"."+fraction);
System.exit(0);
}
}
- relates to
-
JDK-4210230 Major JDK 1.2 text rendering performance regression (6x-267x slower than 1.1x)
-
- Closed
-