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

Why hotspot is slower than openJ9?

XMLWordPrintable

    • x86_64
    • linux_ubuntu

      ADDITIONAL SYSTEM INFORMATION :
      hotspot-jdk-11.0.15

      A DESCRIPTION OF THE PROBLEM :
      When I executed this code, I found that the hotspot running time was much longer than that of openj9. After I used forced JIT compilation, the time was longer than that of direct running

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      6525276770152
      298045193

      real 0m0.572s
      user 0m0.642s
      sys 0m0.128s
      ACTUAL -
      time openjdk/hotspot-jdk-11.0.15/build/linux-x86_64-normal-server-fastdebug/jdk/bin/java -server B
      6525276770152
      781864643

      real 0m13.379s
      user 1m14.485s
      sys 0m0.570s
      (base) jvm_debug# time openjdk/hotspot-jdk-11.0.15/build/linux-x86_64-normal-server-fastdebug/jdk/bin/java -client B
      6525276770152
      765519146

      real 0m12.452s
      user 1m7.885s
      sys 0m0.555s
      (base) jvm_debug# time openjdk/hotspot-jdk-11.0.15/build/linux-x86_64-normal-server-fastdebug/jdk/bin/java B
      6525276770152
      770456380

      real 0m11.114s
      user 0m57.239s
      sys 0m0.550s

      ---------- BEGIN SOURCE ----------
      public class B {
          public static void main(String[] args) {
              long startTime = System.nanoTime();

              long result = performIntensiveCalculations();

              long endTime = System.nanoTime();
              System.out.println("" + result);
              System.out.println("" + (endTime - startTime) + " ");
          }

          private static long performIntensiveCalculations() {
              long sum = 0;
              for (int i = 1; i <= 100000000; i++) {
                  sum += complexCalculation(i);
              }
              return sum;
          }

          private static int complexCalculation(int x) {
              int y = x * 33;
              y = y ^ (y << 10);
              y += y >> 3;
              y ^= (y << 4);
              y *= 7;
              y = y ^ (y << 9);
              y += y >> 2;
              y ^= (y << 5);
              y *= 3;
              return y;
          }
      }
      ---------- END SOURCE ----------

            mcadizolivar Mario Cadiz Olivares
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: