Bug 540575 - Drawing performance is terrible when antialiasing is enabled
Summary: Drawing performance is terrible when antialiasing is enabled
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: java-1.6.0-openjdk
Version: 13
Hardware: All
OS: Linux
low
medium
Target Milestone: ---
Assignee: Denis Lila
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2009-11-23 17:39 UTC by Simon Andrews
Modified: 2011-03-16 17:32 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-03-16 17:32:15 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
A small program which displays the described problem (1.22 KB, text/plain)
2009-11-23 17:39 UTC, Simon Andrews
no flags Details

Description Simon Andrews 2009-11-23 17:39:54 UTC
Created attachment 373184 [details]
A small program which displays the described problem

Description of problem:

Simple paint routines run under openJDK run horrendously slowly under openJDK when the antialiasing option is given to the graphics object.  The same code without antialiasing or run using Sun's JRE runs very quickly.


Version-Release number of selected component (if applicable):
java-1.6.0-openjdk-1.6.0.0-33.b16.fc12.x86_64
jre-1.6.0_15-fcs.x86_64

How reproducible:
Always

Steps to Reproduce:
1.Run the attached program to do 10 redraws of a fairly complex scene with aa
  
Actual results:

From the openJDK with AA 10 refreshes take ~14000ms.

From the openJDK without AA 10 refreshes take ~300ms

From the Sun JRE with AA 10 refreshes take ~750ms

From the Sun JRE without AA 10 refreshes take ~300ms

On the antialiased results the openJDK is about 20X slower than the sun JRE.

Expected results:

OpenJDK and Sun JRE take about the same amount of time.  The overhead for AA is of the order of 2X.

Additional info:

This appears to be a regression which happened some time during the F11 timeframe.  We suddenly noticed a drop in our application's performance and found it could be fixed by using the Sun JRE.  Until then we'd been happily using openJDK.  It's only now I've tracked down the source of the problem.

If it matters, our machines all run Nvidia graphics cards, but this problem has been reproduced under the nvidia binary drivers and the open source nv and nouveau drivers - so I suspect it's not related directly to hardware.

Comment 1 Denis Lila 2010-08-20 20:10:56 UTC
I pushed a changeset to openjdk7 meant to improve anti aliasing performance (among other things). http://hg.openjdk.java.net/jdk7/2d/jdk/rev/d47bd9d94ba4 is
the link to it.

I ran some tests on my machine with the given reproducer, and these are the results I got:
           | openjdk 7 without | 7 with my |          |
           |    my change      |  change   | openjdk6 | sun jre
------------------------------------------------------------------
time (ms): |      7450         |    2500   |  15000   |   550

So, as can be seen, although my patch improves things, most of the improvements
come from just openjdk7 itself (7450 ms vs. 15000 ms).

I noticed that in the reproducer g.drawLine is used to draw the lines.
In these cases drawlines should be avoided, if possible. It is much faster to make a Path2D, put all the lines to be drawn in it, and render them all in bulk.
I re-ran the tests with g2.draw(path) instead of g.drawline, and these are the results:
           | openjdk 7 without | 7 with my |          |
           |    my change      |  change   | openjdk6 | sun jre
------------------------------------------------------------------
time (ms): |       3000        |   2000    |   4000   |   1000

Comment 2 Bug Zapper 2010-11-04 05:36:32 UTC
This message is a reminder that Fedora 12 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 12.  It is Fedora's policy to close all
bug reports from releases that are no longer maintained.  At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '12'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 12's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 12 is end of life.  If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora please change the 'version' of this 
bug to the applicable version.  If you are unable to change the version, 
please add a comment here and someone will do it for you.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events.  Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Comment 3 Simon Andrews 2010-11-04 09:10:02 UTC
This bug is still present on a fully updated F13 machine.

java-1.6.0-openjdk-1.6.0.0-43.1.8.2.fc13.x86_64

Using the test program I attached before the stats were:

OpenJDK No AA 278ms
SunJRE  No AA 271ms

OpenJDK With AA 9715ms <<- This is the problem
SunJRE  With AA  726ms

Comment 4 Denis Lila 2010-11-04 13:07:12 UTC
Hello Simon.

I'm sorry about this. My fixes haven't made it into F13 yet, so that's why it's still slow. They should be there on the next update of icedtea though.

When I run your program I get 13000ms with openjdk6. When I run it with openjdk7 with my fixes it runs in 1900ms.

You won't see this drastic of an improvement because you'll still be using jdk6, but the improvement should still be considerable, and I'm still working on new performance improvements.

Comment 5 Denis Lila 2011-03-16 17:32:15 UTC
This was fixed in icedtea6 head and 1.10 with the backports of the new parallelogram pipes.


Note You need to log in before you can comment on or make changes to this bug.