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

type inference exponential compilation performance

    XMLWordPrintable

    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.

        Attachments

          Issue Links

            Activity

              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: