This issues is related to customer escalation 1-16558969, case 64980469.
Here's the results I got from running JDK 5.0u6 on the same opteron 2100z box:
Double.doubleToLongBits Double.longBitsToDouble
---------------------------------------------------------------
WinXP/-server 172 ms 109 ms
WinXP/-client 5016 ms 8734 ms
RHEL3/-server 176 ms 107 ms
RHEL3/-client 6302 ms 7967 ms
The results seems to be cpu processor and/or OS dependent
Here's the testcases (it is coded such that the double or the long is not
constant within the loop):
public class d2l {
static double a = 1.0, d = 0.0;
static long l;
public static void main(String args[]) {
long s = System.currentTimeMillis();
for (int i=0; i<100000000; i++) {
a +=1.0;
l = Double.doubleToLongBits(a);
}
long f = System.currentTimeMillis();
System.out.println("Diff " + (f-s) + " ms");
}
}
public class l2d {
static double a = 1.0, d = 0.0;
static long l;
public static void main(String args[]) {
long s = System.currentTimeMillis();
for (int i=0; i<100000000; i++) {
l += 1;
d = Double.longBitsToDouble(l);
}
long f = System.currentTimeMillis();
System.out.println("Diff " + (f-s) + " ms");
}
}
Here's the results I got from running JDK 5.0u6 on the same opteron 2100z box:
Double.doubleToLongBits Double.longBitsToDouble
---------------------------------------------------------------
WinXP/-server 172 ms 109 ms
WinXP/-client 5016 ms 8734 ms
RHEL3/-server 176 ms 107 ms
RHEL3/-client 6302 ms 7967 ms
The results seems to be cpu processor and/or OS dependent
Here's the testcases (it is coded such that the double or the long is not
constant within the loop):
public class d2l {
static double a = 1.0, d = 0.0;
static long l;
public static void main(String args[]) {
long s = System.currentTimeMillis();
for (int i=0; i<100000000; i++) {
a +=1.0;
l = Double.doubleToLongBits(a);
}
long f = System.currentTimeMillis();
System.out.println("Diff " + (f-s) + " ms");
}
}
public class l2d {
static double a = 1.0, d = 0.0;
static long l;
public static void main(String args[]) {
long s = System.currentTimeMillis();
for (int i=0; i<100000000; i++) {
l += 1;
d = Double.longBitsToDouble(l);
}
long f = System.currentTimeMillis();
System.out.println("Diff " + (f-s) + " ms");
}
}
- relates to
-
JDK-5037596 Float.floatToIntBits very slow on Solaris
-
- Resolved
-