Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6925409

OpenJDK: Huge drop in performace when anti-aliasing enabled

    XMLWordPrintable

    Details

    • Type: Enhancement
    • Status: Closed
    • Priority: P4
    • Resolution: Duplicate
    • Affects Version/s: 7
    • Fix Version/s: None
    • Component/s: client-libs
    • Labels:
    • Subcomponent:
      2d
    • CPU:
      x86
    • OS:
      linux

      Description

      FULL PRODUCT VERSION :
      [problematic version]
      java version "1.6.0_0"
      OpenJDK Runtime Environment (IcedTea6 1.6) (fedora-33.b16.fc12-x86_64)
      OpenJDK 64-Bit Server VM (build 14.0-b16, mixed mode)

      [working version]


      ADDITIONAL OS VERSION INFORMATION :
      Linux 2.6.31.12-174.2.3.fc12.x86_64 #1 SMP Mon Jan 18 19:52:07 UTC 2010 x86_64 x86_64 x86_64 GNU/Linux

      A DESCRIPTION OF THE PROBLEM :
      java version "1.6.0_15"
      Java(TM) SE Runtime Environment (build 1.6.0_15-b03)
      Java HotSpot(TM) 64-Bit Server VM (build 14.1-b02, mixed mode)

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Run the attached test case under Sun java and OpenJDK it will report the time taken to run the drawing routine. Without anti-aliasing the results are very similar, but with aa enabled the OpenJDK is around 20X slower than the sun java.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Similar performance under anti-aliasing from Sun Java and OpenJDK
      ACTUAL -
        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.


      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.awt.Graphics;
      import java.awt.Graphics2D;
      import java.awt.RenderingHints;
      import java.util.Date;

      import javax.swing.JFrame;
      import javax.swing.JPanel;


      public class SlowDrawApplication extends JFrame {


      public SlowDrawApplication () {
      setContentPane(new SlowDrawPanel());
      setSize(800,800);
      setLocationRelativeTo(null);
      setVisible(true);
      }

      public static void main(String[] args) {
      new SlowDrawApplication();
      }


      private class SlowDrawPanel extends JPanel {

      private int redrawCount = 0;
      private long startTime = (new Date()).getTime();
      private long endTime;


      public void paint (Graphics g) {
      super.paint(g);

      // Comment out this line to remove anti-aliasing
      ((Graphics2D)g).setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);

      if (redrawCount == 10) {
      endTime = (new Date()).getTime();
      }
      if (redrawCount > 10) {
      g.drawString("Finished in "+(endTime-startTime)+"ms", getWidth()/2, getHeight()/2);
      return;
      }

      ++redrawCount;

      // Do lots of angled lines

      for (int x=10;x<getWidth();x+=10) {
      for (int y=10;y<getHeight();y+=10) {
      g.drawLine(x, y, x-10, y-10);
      }
      }

      repaint();
      }
      }
      }

      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Disabling anti-aliasing.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              avu Alexey Ushakov
              Reporter:
              ndcosta Nelson Dcosta (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: