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

type inference exponential compilation performance

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 9
    • Component/s: tools
    • Labels:
    • Subcomponent:
    • Introduced In Version:
      8
    • CPU:
      generic
    • OS:
      generic

      Description

      20 lines source takes an HOUR to compile:

      class C<U> {
          U fu;
          C() {}
          C(C<U> other) { this.fu = other.fu; }
          C(U fu) { this.fu = fu; }

          static <U> C<U> m(C<U> src) { return new C<U>(src); }

          public static void main(String argv[]) {
              /* type inference is expected here: */
              C<String> c2 = m(new C<>(m(new C<>() )) );
              C<String> c3 = m(new C<>(m(new C<>(m(new C<>() )) )) );
              C<String> c4 = m(new C<>(m(new C<>(m(new C<>(m(new C<>() )) )) )) ); // Javac(1.04), ECJ(.71s)
              C<String> c5 = m(new C<>(m(new C<>(m(new C<>(m(new C<>(m(new C<>() )) )) )) )) ); // Javac(2.02s), ECJ(1.17s)
              C<String> c6 = m(new C<>(m(new C<>(m(new C<>(m(new C<>(m(new C<>(m(new C<>() )) )) )) )) )) ); // Javac(4.84s) ECJ(1.67s)
              C<String> c7 = m(new C<>(m(new C<>(m(new C<>(m(new C<>(m(new C<>(m(new C<>(m(new C<>() )) )) )) )) )) )) ); // Javac(14.99s) ECJ(10.82s)
              C<String> c8 = m(new C<>(m(new C<>(m(new C<>(m(new C<>(m(new C<>(m(new C<>(m(new C<>(m(new C<>() )) )) )) )) )) )) )) ); // Javac(79.62s) ECJ(134.64s)
              C<String> c9 = m(new C<>(m(new C<>(m(new C<>(m(new C<>(m(new C<>(m(new C<>(m(new C<>(m(new C<>(m(new C<>() )) )) )) )) )) )) )) )) ); // Javac(437s) ECJ(1305s)
              C<String> c10 = m(new C<>(m(new C<>(m(new C<>(m(new C<>(m(new C<>(m(new C<>(m(new C<>(m(new C<>(m(new C<>(m(new C<>()))))))))))))))))))); // 3600
          }
      }

      Each lines show how long it takes to compile it in seconds.
      Time is about the same for original jdk8.0 and latest jdk8u20 and jdk9.

        Issue Links

          Activity

          Hide
          enekipel Ella Nekipelova (Inactive) added a comment - - edited
          Four JCK tests fail the precompilation step because it takes too much time to execute them:
          lang/INFR/infr066/infr06603m022/infr06603m022_rt.html
          lang/INFR/infr066/infr06603m03/infr06603m03_rt.html
          lang/INFR/infr066/infr06603m131/infr06603m131_rt.html
          lang/INFR/infr066/infr06603m232/infr06603m232_rt.html
          Show
          enekipel Ella Nekipelova (Inactive) added a comment - - edited Four JCK tests fail the precompilation step because it takes too much time to execute them: lang/INFR/infr066/infr06603m022/infr06603m022_rt.html lang/INFR/infr066/infr06603m03/infr06603m03_rt.html lang/INFR/infr066/infr06603m131/infr06603m131_rt.html lang/INFR/infr066/infr06603m232/infr06603m232_rt.html
          Hide
          larbouzo Leonid Arbuzov added a comment -
          This may be considered as too much requiring JCK tests. Filed JCK-7303646. No reason to raise the priority just because of that.
          Show
          larbouzo Leonid Arbuzov added a comment - This may be considered as too much requiring JCK tests. Filed JCK-7303646. No reason to raise the priority just because of that.
          Hide
          mcimadamore Maurizio Cimadamore added a comment -
          A test for this has been added as part of the changeset for JDK-8078093.
          Show
          mcimadamore Maurizio Cimadamore added a comment - A test for this has been added as part of the changeset for JDK-8078093 .
          Hide
          larbouzo Leonid Arbuzov added a comment - - edited
          The issue is still reproduced with latest JDK9 promoted build b81.
          If the issue is fixed, please indicate build#. "Cannot reproduce" doesn't apply in such case.
          Show
          larbouzo Leonid Arbuzov added a comment - - edited The issue is still reproduced with latest JDK9 promoted build b81. If the issue is fixed, please indicate build#. "Cannot reproduce" doesn't apply in such case.
          Hide
          larbouzo Leonid Arbuzov added a comment - - edited
          A significant improvement is observed with jdk9b84.
          Three JCK tests now pass with default time limit (10min):
          infr06603m022 1.4 sec
          infr06603m131 1 min 50 sec
          infr06603m232 2 min 34 sec

          infr06603m03 - 32 min 30 sec

          For comparison jdk9b80 took 1h25min to finish the first testcase infr06603m022.
          It's 3000x speedup.
          Show
          larbouzo Leonid Arbuzov added a comment - - edited A significant improvement is observed with jdk9b84. Three JCK tests now pass with default time limit (10min): infr06603m022 1.4 sec infr06603m131 1 min 50 sec infr06603m232 2 min 34 sec infr06603m03 - 32 min 30 sec For comparison jdk9b80 took 1h25min to finish the first testcase infr06603m022. It's 3000x speedup.
          Hide
          mcimadamore Maurizio Cimadamore added a comment -
          You might want to keep an eye on when JDK-8046685 becomes available in the next promoted build - this should take care of your remaining issues.
          Show
          mcimadamore Maurizio Cimadamore added a comment - You might want to keep an eye on when JDK-8046685 becomes available in the next promoted build - this should take care of your remaining issues.
          Hide
          larbouzo Leonid Arbuzov added a comment -
          jdk9b84 (linix-x64) takes about 2 sec to pass each of the four tests (on scaaa744) - great results!

          % time sh $JCK/tests/lang/INFR/infr066/infr06603m022/infr06603m022.ksh
          -- passed
          4.367u 1.087s 0:02.23 243.9% 0+0k 0+272io 0pf+0w
          % time sh $JCK/tests/lang/INFR/infr066/infr06603m131/infr06603m131.ksh
          Note: infr06603m131.java uses unchecked or unsafe operations.
          Note: Recompile with -Xlint:unchecked for details.
          -- passed
          5.530u 1.038s 0:02.34 280.3% 0+0k 0+272io 0pf+0w
          % time sh $JCK/tests/lang/INFR/infr066/infr06603m232/infr06603m232.ksh
          -- passed
          4.900u 1.149s 0:02.34 258.1% 0+0k 0+272io 0pf+0w
          % time sh $JCK/tests/lang/INFR/infr066/infr06603m03/infr06603m03.ksh
          -- passed
          5.630u 1.125s 0:02.02 334.1% 0+0k 0+272io 0pf+0w
          Show
          larbouzo Leonid Arbuzov added a comment - jdk9b84 (linix-x64) takes about 2 sec to pass each of the four tests (on scaaa744) - great results! % time sh $JCK/tests/lang/INFR/infr066/infr06603m022/infr06603m022.ksh -- passed 4.367u 1.087s 0:02.23 243.9% 0+0k 0+272io 0pf+0w % time sh $JCK/tests/lang/INFR/infr066/infr06603m131/infr06603m131.ksh Note: infr06603m131.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. -- passed 5.530u 1.038s 0:02.34 280.3% 0+0k 0+272io 0pf+0w % time sh $JCK/tests/lang/INFR/infr066/infr06603m232/infr06603m232.ksh -- passed 4.900u 1.149s 0:02.34 258.1% 0+0k 0+272io 0pf+0w % time sh $JCK/tests/lang/INFR/infr066/infr06603m03/infr06603m03.ksh -- passed 5.630u 1.125s 0:02.02 334.1% 0+0k 0+272io 0pf+0w
          Hide
          vromero Vicente Arturo Romero Zaldivar added a comment -
          Fixed by JDK-8046685
          Show
          vromero Vicente Arturo Romero Zaldivar added a comment - Fixed by JDK-8046685

            People

            • Assignee:
              vromero Vicente Arturo Romero Zaldivar
              Reporter:
              larbouzo Leonid Arbuzov
            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: