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

REGRESSION: performance regression in Jre 5.0 and Jre 6.0

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P3 P3
    • None
    • 5.0
    • hotspot
    • x86
    • windows_xp

      FULL PRODUCT VERSION :
      Java HotSpot(TM) Server VM (build 1.5.0-b64, mixed mode)
      Java HotSpot(TM) Server VM (build 1.6.0-ea-b14, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows XP [Version 5.1.2600]

      A DESCRIPTION OF THE PROBLEM :
      Performance regression in a simple loop evaluating a double expression.

      ACTUAL -
      Jre 1.4.1 -server : Testing 1.0E8 inlined double moltiplications : 1.496 s.
      Jre 5.0 -server : Testing 1.0E8 inlined double moltiplications : 10.722 s.
      Jre 6.0 -server : Testing 1.0E8 inlined double moltiplications : 10.737 s.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.io.*;


      public class Speed
      {
          static class Evaluator
          {
             public final double eval(double i)
              { return (i * 0.123456) / (i + 1.0); }
          }
          
          static double r;

          public static void main(String[] args)
          {
              Speed sp = new Speed(args);
          }

          public Speed(String[] args)
          {
              run();
          }

          static void printTime(String mes, long time, double v)
          {
              System.out.print(" Testing " + mes + " : ");
              System.out.println( (time / 1000.0) + " s.");
              if (v > 0.0)
                  System.out.println(" result = " + v);
              System.out.println();
          }

          public void run()
          {
      // Test # 2
      testDoubleOpsViaFunctionCall((int) 1E8);
      // Test # 3
      testInlinedDoubleOps((int) 1E8);
                  
          }


          // double operation with function call
          long testDoubleOpsViaFunctionCall(int n)
          {
              double r = 0.0;
              Evaluator evaluator = new Evaluator();
              long start = System.currentTimeMillis();
              for (int i = 1; i <= n; i++)
                  r += evaluator.eval((double) i);
              long time = System.currentTimeMillis() - start ;
              printTime(Double.toString((double) n) + " double moltiplications via function call", time, r);
              return time ;
          }

          // Test # 3 -B
          long testInlinedDoubleOps(int n)
          {
              int i;
              double r = 0.0;

              long start = System.currentTimeMillis();
              for (i = 1; i < n; i++)
                  r += (i * 0.123456) / (i + 1.0);
              long time = System.currentTimeMillis() - start;
              printTime(Double.toString((double) n) + " inlined double moltiplications", time, r);
              return time ;
          }

      }

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

      Release Regression From : 1.4.2
      The above release value was the last known release where this
      bug was known to work. Since then there has been a regression.
      ###@###.### 2004-12-22 01:12:16 GMT

            rknippelsunw Ross Knippel (Inactive)
            gmanwanisunw Girish Manwani (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: