Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 6401715
Votes 0
Synopsis double & int ops performance regression
Category hotspot:compiler2
Reported Against
Release Fixed mustang(b80)
State 10-Fix Delivered, bug
Priority: 4-Low
Related Bugs 6417150
Submit Date 21-MAR-2006
Description
A DESCRIPTION OF THE REGRESSION :
 There are regressions on doubles and ints expressions.


REPRODUCIBLE TESTCASE OR STEPS TO REPRODUCE:
import java.io.*;


public class Speed
{
    static class Evaluator
    {
       public final double eval(double i)
        { return (i * 0.123456) / (i + 1.0); }
    }
    
    Object obj; // used for isA tests
    static double r;

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

    public Speed(String[] args)
    {
        obj = this;
        int ns = args.length;
        int niters = 3;
        for (int i = 0; i < ns; i++)
        {
            try
            {
                niters = Integer.parseInt(args[i]);
            } catch (Exception ex)
            {}
        }
        run(niters);
    }

    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(int idx)
    {
        final int ncycle = idx;
        long start = System.currentTimeMillis();
        int k, i, n = (int) 1E7;
        for (k = 1; k <= ncycle; k++)
        {
            System.out.println();
            System.out.println(" --------------------------" + Integer.toString(k)
                    + "--------------------------------");
            System.out.println();
            System.out.println();
            
            long iter_time = 0 ;
            // Test # 2
            iter_time += testDoubleOpsViaFunctionCall((int) 1E8);
            // Test # 3
            iter_time += testInlinedDoubleOps((int) 1E8);
            // Test # 4
            iter_time += testIntOperations((int) 1E9);

        }
    }

    // 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 (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(n + " inlined double moltiplications", time, r);
        return time ;
    }

    long testIntOperations(int n)
    {
        int i, a = 0, b = 2;
        long start = System.currentTimeMillis();
        for (i = 1; i <= n; i++)
            a += a - i * 3;
        long time = System.currentTimeMillis() - start;
        printTime(n + " int moltiplications + additions", time,
                (double) a);
        return time ;
    }

}


RELEASE LAST WORKED:
5.0 Update 6

RELEASE TEST FAILS:
mustang-beta

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Java HotSpot(TM) Server VM (build 1.5.0_06-b05, mixed mode)

After several warm-up iterations ...

    Testing 100000000 double moltiplications via function call : 1.437
      result = 1.2345597781357473E7

    Testing 100000000 inlined double moltiplications : 1.453 s.
      result = 1.2345597781357473E7

    Testing 1000000000 int moltiplications + additions : 0.969 s.
ACTUAL -

Java(TM) 2 Runtime Environment, Standard Edition (build 1.6.0-beta2-b73)
Java HotSpot(TM) Server VM (build 1.6.0-beta2-b73, mixed mode)

After several warm-up iterations ...

 Testing 100000000 double moltiplications via function call : 1.765 s.
   result = 1.2345597781357473E7

 Testing 100000000 inlined double moltiplications : 1.766 s.
   result = 1.2345597781357473E7

 Testing 1000000000 int moltiplications + additions : 2.172 s.

Release Regression From : 5.0u6
The above release value was the last known release where this 
bug was known to work. Since then there has been a regression.
Posted Date : 2006-03-21 21:48:44.0
Work Around
N/A
Evaluation
The function IdealLoopTree::compute_profile_trip_cnt computes trip counts based on branch predictions made in the parser.  For historical reasons, the counts there are wrongly scaled by FreqCountInovocations, which is 1500.
Posted Date : 2006-03-22 19:57:31.0
Comments
  
  Include a link with my name & email   


PLEASE NOTE: JDK6 is formerly known as Project Mustang