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

performance differences in Double conversion methods between Linux and WinXP

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P3 P3
    • None
    • 5.0u6
    • hotspot
    • None
    • x86
    • windows

      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");
        }
      }

            never Tom Rodriguez
            lkchow Lawrence Chow
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: