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

G1: Before exit verification much slower than with Parallel GC

XMLWordPrintable

    • gc

      A DESCRIPTION OF THE PROBLEM :
      When I executed the java file, I noticed a significant performance difference between jdk11, jdk21 and jdk8 when executing a large number of loops. jdk11 ran over 400 times longer than jdk8. I think the difference is in the helperMethod method, so I should use "inline optimization" in this part to reduce the runtime.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      time ./hotspot-jdk8u352/build/linux-x86_64-normal-server-fastdebug/jdk/bin/java Test
      output:
      2

      real 0m2.967s
      user 0m0.842s
      sys 0m1.549s
      ACTUAL -
      time ./hotspot-jdk-21.0.2/build/linux-x86_64-server-fastdebug/images/jdk/bin/java Test

      output:
      2

      real 3m44.658s
      user 3m46.811s
      sys 0m1.244s

      time ./hotspot-jdk-11.0.15/build/linux-x86_64-normal-server-fastdebug/jdk/bin/java Test

      output:
      2

      real 14m12.330s
      user 54m51.359s
      sys 0m1.800s

      ---------- BEGIN SOURCE ----------
      import java.util.concurrent.CountDownLatch;

      public class Test {

          static int n = 847734685;

          String countAndSay(int n) throws Exception {
              byte[] sessionId = { -96, 68, -45, 10, 31, -126, -47, 68, -76, -67 };
              if (sessionId == null) {
                  throw new NullPointerException("session id cannot be null");
              }
              
              for (int i = 0; i < n; i++) {
                  int j = helperMethod(i);
              }
              
              String[] strs = new String[n + 1];
              strs[0] = "2";
              return strs[0];
          }
          
          int helperMethod(int index) {
              int num1 = index * 2;
              int num2 = num1 + 5;
              int result = calculateResult(num1, num2);
              return result;
          }
          
          int calculateResult(int a, int b) {
              return a * b;
          }

          public static void main(String[] args) throws Exception {
              System.out.println(new Test().countAndSay(n));
          }
      }
      ---------- END SOURCE ----------

            Unassigned Unassigned
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved: