Relates :
|
|
Relates :
|
|
Relates :
|
Name: rmT116609 Date: 05/01/2003 FULL PRODUCT VERSION : JDK 1.4 and later java version "1.4.2-beta" Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2-beta-b19) Java HotSpot(TM) Client VM (build 1.4.2-beta-b19, mixed mode) FULL OS VERSION : Windows 2000 A DESCRIPTION OF THE PROBLEM : The Math.cos and Math.sin procedures are several times SLOWER in JDK 1.4 than JDK 1.3. I'm sure this has to do with the adoption of the StrictMath library. Performance should not get drastically worse when you upgrade your JDK from 1.3 to 1.4. Similar bugs have been reported, but they are listed as CLOSED. What does this mean? Is it going to be fixed in a future JDK release? Is it not going to be fixed? Is the old (fast) Math library available somewhere as a JAR file? Can it be used in JDK 1.4 applications? STEPS TO FOLLOW TO REPRODUCE THE PROBLEM : System.out.println("Benchmark test..." + new java.util.Date()); double d = 0.5; for (int i=0; i < 10000000; i++) { d = (d * i) / 3.1415926; d = Math.sin(d); d = Math.cos(d); d = Math.sqrt(d) * 3.1415926; } System.out.println("Benchmark done. Time is " + new java.util.Date()); System.out.println("D=" + d); EXPECTED VERSUS ACTUAL BEHAVIOR : In JDK 1.3, 1.3.1_08 this loop takes 3 seconds In JDK 1.4, 1.4.2-beta this loop takes 21 seconds REPRODUCIBILITY : This bug can be reproduced always. ---------- BEGIN SOURCE ---------- public class Benchmark { public static void main(String[] args) { System.out.println("Benchmark test..." + new java.util.Date()); double d = 0.5; for (int i=0; i < 10000000; i++) { d = (d * i) / 3.1415926; d = Math.sin(d); d = Math.cos(d); d = Math.sqrt(d) * 3.1415926; } System.out.println("Benchmark done. Time is " + new java.util.Date()); System.out.println("D=" + d); } } ---------- END SOURCE ---------- Release Regression From : 1.3.1_08 The above release value was the last known release where this bug was known to work. Since then there has been a regression. (Review ID: 185149) ====================================================================== Name: rmT116609 Date: 05/01/2003 A DESCRIPTION OF THE REQUEST : My numeric calculation intensive program runs 8 times slower with 1.4 as opposed to 1.3.1. I am doing Math.sin(), Math.cos(), and Math.sqrt(). I realize that you made StrictMath the default math library--is there a way to run the faster 1.3.1 math routines? JUSTIFICATION : The scientific community wants fast math functions with JDK 1.4. EXPECTED VERSUS ACTUAL BEHAVIOR : Math.sin(), Math.cos(), and Math.sqrt() to be as fast under JDK 1.4 as JDK 1.3 Math.sin(), Math.cos(), and Math.sqrt() are much slower under JDK 1.4 as JDK 1.3 ---------- BEGIN SOURCE ---------- public class Benchmark { public static void main(String[] args) { System.out.println("Benchmark test..." + new java.util.Date()); double d = 0.5; for (int i=0; i < 20000000; i++) { d = (d * i) / 3.1415926; d = Math.sin(d); d = Math.cos(d); d = Math.sqrt(d) * 3.1415926; } System.out.println("Benchmark done. Time is " + new java.util.Date()); System.out.println("D=" + d); } } ---------- END SOURCE ---------- (Review ID: 184982) ======================================================================
|