-
Bug
-
Resolution: Won't Fix
-
P4
-
1.4.1
-
x86
-
windows_2000
Name: pa48320 Date: 09/03/2002
bug 4527745 was marked closed/fixed in 1.4.1. However, with the latest build (19) we are seeing slow downs with drawing vertical lines, empty rectangles, and filled rectangles of about 3 times. The original bug mentioned clipping as an issue in the test. Our test should not have any clipping. Tests were made Onscreen vs Offscreen and the onscreen performance was way slower in 1.4.1. The following routines were used to test the problem:
public java.awt.Image image = null;
public boolean paintFlag = false;
public void paint(java.awt.Graphics g)
{
super.paint(g);
if (image == null)
image = createImage( 300, 250 );
if (!paintFlag)
return;
System.out.println("Graphics timing test on screen-"+System.getProperty("java.vm.version"));
drawImage(g);
System.out.println("Graphics timing test off screen-"+System.getProperty("java.vm.version"));
System.out.println(image.getClass().getName());
drawImage(image.getGraphics());
// Blit the image.
g.drawImage( image, 300, 0, this );
paintFlag = false;
}
public void drawImage(java.awt.Graphics ig)
{
// Clear the image and draw the title.
int maxShape = 3;
int maxSize = 10;
int maxIter = 200000;
ig.clearRect( 0, 0, getWidth() / 2, getHeight());
int ymin = getInsets().top;
int xmin = getInsets().left;
ig.drawString( "Time in milliseconds, " + maxIter + " markers:", xmin+2, ymin+12 );
System.out.println( "Time in milliseconds, " + maxIter + " markers:" );
int y0 = 0;
// Draw all shapes.
for( int shape = 0; ( shape < maxShape ); shape++ )
{
if( shape == 0 )
System.out.println("Vertical bars");
else if( shape == 1 )
System.out.println("Empty rectangles");
else
System.out.println("Filled rectangles");
// Calculate the center.
int x0 = 60 * ( shape % 10 ) + 10+xmin;
y0 = ymin+25 + 250 * ( shape / 10 );
// Draw all sizes.
for( int size = 1; ( size <= maxSize ); size++ )
{
// Draw all iterations.
int size2 = size / 2;
long time0 = ( long )System.currentTimeMillis();
for( int j = 0; ( j < maxIter ); j++ )
{ if( shape == 0 )
ig.drawLine( x0, y0 - size2, x0, y0 - size2 + size );
else if( shape == 1 )
ig.drawRect( x0 - size2, y0 - size2, size, size );
else
ig.fillRect( x0 - size2, y0 - size2, size, size );
}
// Draw the time.
long time1 = ( long )System.currentTimeMillis();
long time = ( time1 - time0 );
String secs = "";
for( int j = 10; ( j < 10000 ); j *= 10 )
{ if( time < j )
secs += " ";
}
secs += time;
ig.drawString( secs, x0 + 7, y0 + 5 );
System.out.println(secs);
y0 += 20;
}
}
}
This test produced the following timings:
Graphics timing test on screen-1.4.1-rc-b19
Time in milliseconds, 200000 markers:
Vertical bars
750
485
500
500
485
485
500
484
500
485
Empty rectangles
515
1766
1703
1719
1750
1781
1734
1719
1703
1765
Filled rectangles
500
500
485
500
484
500
485
500
484
516
Graphics timing test off screen-1.4.1-rc-b19
Time in milliseconds, 200000 markers:
Vertical bars
234
234
282
250
235
250
250
281
250
250
Empty rectangles
250
250
250
250
265
282
265
266
281
281
Filled rectangles
219
219
250
234
235
234
250
266
250
250
Graphics timing test on screen-1.3.1_03-b03
Time in milliseconds, 200000 markers:
Vertical bars
2453
2313
2015
1938
1937
1985
1953
1984
1938
1938
Empty rectangles
3219
3203
3234
3219
3203
3187
3188
3219
3218
3204
Filled rectangles
1968
1969
1969
1969
1968
1969
1969
1953
1953
1953
Graphics timing test off screen-1.3.1_03-b03
Time in milliseconds, 200000 markers:
Vertical bars
156
188
171
172
172
188
187
203
188
203
Empty rectangles
156
156
188
172
156
188
171
188
203
188
Filled rectangles
156
156
172
187
188
187
188
203
219
250
======================================================================
bug 4527745 was marked closed/fixed in 1.4.1. However, with the latest build (19) we are seeing slow downs with drawing vertical lines, empty rectangles, and filled rectangles of about 3 times. The original bug mentioned clipping as an issue in the test. Our test should not have any clipping. Tests were made Onscreen vs Offscreen and the onscreen performance was way slower in 1.4.1. The following routines were used to test the problem:
public java.awt.Image image = null;
public boolean paintFlag = false;
public void paint(java.awt.Graphics g)
{
super.paint(g);
if (image == null)
image = createImage( 300, 250 );
if (!paintFlag)
return;
System.out.println("Graphics timing test on screen-"+System.getProperty("java.vm.version"));
drawImage(g);
System.out.println("Graphics timing test off screen-"+System.getProperty("java.vm.version"));
System.out.println(image.getClass().getName());
drawImage(image.getGraphics());
// Blit the image.
g.drawImage( image, 300, 0, this );
paintFlag = false;
}
public void drawImage(java.awt.Graphics ig)
{
// Clear the image and draw the title.
int maxShape = 3;
int maxSize = 10;
int maxIter = 200000;
ig.clearRect( 0, 0, getWidth() / 2, getHeight());
int ymin = getInsets().top;
int xmin = getInsets().left;
ig.drawString( "Time in milliseconds, " + maxIter + " markers:", xmin+2, ymin+12 );
System.out.println( "Time in milliseconds, " + maxIter + " markers:" );
int y0 = 0;
// Draw all shapes.
for( int shape = 0; ( shape < maxShape ); shape++ )
{
if( shape == 0 )
System.out.println("Vertical bars");
else if( shape == 1 )
System.out.println("Empty rectangles");
else
System.out.println("Filled rectangles");
// Calculate the center.
int x0 = 60 * ( shape % 10 ) + 10+xmin;
y0 = ymin+25 + 250 * ( shape / 10 );
// Draw all sizes.
for( int size = 1; ( size <= maxSize ); size++ )
{
// Draw all iterations.
int size2 = size / 2;
long time0 = ( long )System.currentTimeMillis();
for( int j = 0; ( j < maxIter ); j++ )
{ if( shape == 0 )
ig.drawLine( x0, y0 - size2, x0, y0 - size2 + size );
else if( shape == 1 )
ig.drawRect( x0 - size2, y0 - size2, size, size );
else
ig.fillRect( x0 - size2, y0 - size2, size, size );
}
// Draw the time.
long time1 = ( long )System.currentTimeMillis();
long time = ( time1 - time0 );
String secs = "";
for( int j = 10; ( j < 10000 ); j *= 10 )
{ if( time < j )
secs += " ";
}
secs += time;
ig.drawString( secs, x0 + 7, y0 + 5 );
System.out.println(secs);
y0 += 20;
}
}
}
This test produced the following timings:
Graphics timing test on screen-1.4.1-rc-b19
Time in milliseconds, 200000 markers:
Vertical bars
750
485
500
500
485
485
500
484
500
485
Empty rectangles
515
1766
1703
1719
1750
1781
1734
1719
1703
1765
Filled rectangles
500
500
485
500
484
500
485
500
484
516
Graphics timing test off screen-1.4.1-rc-b19
Time in milliseconds, 200000 markers:
Vertical bars
234
234
282
250
235
250
250
281
250
250
Empty rectangles
250
250
250
250
265
282
265
266
281
281
Filled rectangles
219
219
250
234
235
234
250
266
250
250
Graphics timing test on screen-1.3.1_03-b03
Time in milliseconds, 200000 markers:
Vertical bars
2453
2313
2015
1938
1937
1985
1953
1984
1938
1938
Empty rectangles
3219
3203
3234
3219
3203
3187
3188
3219
3218
3204
Filled rectangles
1968
1969
1969
1969
1968
1969
1969
1953
1953
1953
Graphics timing test off screen-1.3.1_03-b03
Time in milliseconds, 200000 markers:
Vertical bars
156
188
171
172
172
188
187
203
188
203
Empty rectangles
156
156
188
172
156
188
171
188
203
188
Filled rectangles
156
156
172
187
188
187
188
203
219
250
======================================================================