JDK-6211547 : REGRESSION: performance regression in Jre 5.0 and Jre 6.0
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 5.0
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2004-12-22
  • Updated: 2010-08-19
  • Resolved: 2005-01-21
Related Reports
Duplicate :  
Description
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

Comments
EVALUATION Please see update at http://monaco.sfbay/detail.jsp?cr=6211547 Appears server is fixed now, but what about client side and other JVM's going back to 1.4.2. Appears to be a regression in 1.5 and 1.6. last known to work was 1.4.2 ###@###.### 2005-1-21 14:29:52 GMT 26> j2sdk1.4.2_09/bin/java -client Speed Testing 1.0E8 double moltiplications via function call : 4.754 s. result = 1.2345597781357473E7 Testing 1.0E8 inlined double moltiplications : 1.796 s. result = 1.2345597657901473E7 27> jdk1.5.0_02/bin/java -client Speed Testing 1.0E8 double moltiplications via function call : 1.44 s. result = 1.2345597781357473E7 Testing 1.0E8 inlined double moltiplications : 1.343 s. result = 1.2345597657901473E7 28> jdk1.6.0/bin/java -client Speed Testing 1.0E8 double moltiplications via function call : 1.483 s. result = 1.2345597781357473E7 Testing 1.0E8 inlined double moltiplications : 1.343 s. result = 1.2345597657901473E7 29> 29> j2sdk1.4.2_09/bin/java -server Speed Testing 1.0E8 double moltiplications via function call : 1.773 s. result = 1.2345597781357473E7 Testing 1.0E8 inlined double moltiplications : 1.822 s. result = 1.2345597657901473E7 30> jdk1.5.0_02/bin/java -server Speed Testing 1.0E8 double moltiplications via function call : 1.759 s. result = 1.2345597781357473E7 Testing 1.0E8 inlined double moltiplications : 20.704 s. result = 1.2345597657901473E7 31> jdk1.6.0/bin/java -server Speed Testing 1.0E8 double moltiplications via function call : 1.756 s. result = 1.2345597781357473E7 Testing 1.0E8 inlined double moltiplications : 1.691 s. result = 1.2345597657901473E7 ###@###.### 2005-1-21 17:15:38 GMT
21-01-2005