Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Performance regression after 3.34.0 #6373

Closed
cushon opened this issue Dec 16, 2023 · 3 comments · Fixed by #6445
Closed

Performance regression after 3.34.0 #6373

cushon opened this issue Dec 16, 2023 · 3 comments · Fixed by #6445
Assignees
Labels

Comments

@cushon
Copy link
Contributor

cushon commented Dec 16, 2023

I'm seeing some invocations of the nullness checker take significantly longer on versions of the checker framework after 3.34.0.

I minimized an example below. The invocation time more than doubles between 3.34.0 and 3.35.0. The performance for newer versions seems roughly consistent with 3.35.0.

$ time ./checker-framework-3.34.0/checker/bin/javac -processor nullness X.java
real    0m42.137s
user    1m9.228s
sys     0m2.893s

$ time ./checker-framework-3.35.0/checker/bin/javac -processor nullness X.java
real    1m56.321s
user    2m25.035s
sys     0m3.416s
public class X {

  abstract static class C1<
          C extends C1<C, Q, B, D, CR>,
          Q extends C2<C, Q, B, D, CR>,
          B extends C3<C, Q, B, D, CR>,
          D extends C4<C, Q, B, D, CR>,
          CR extends C5<CR>>
      extends C6 {}

  static class C6 {}

  abstract static class C2<
          C extends C1<C, Q, B, D, RT>,
          Q extends C2<C, Q, B, D, RT>,
          B extends C3<C, Q, B, D, RT>,
          D extends C4<C, Q, B, D, RT>,
          RT extends C5<RT>>
      implements C7 {}

  abstract static class C3<
      C extends C1<C, Q, B, D, R>,
      Q extends C2<C, Q, B, D, R>,
      B extends C3<C, Q, B, D, R>,
      D extends C4<C, Q, B, D, R>,
      R extends C5<R>> {}

  abstract static class C4<
      C extends C1<C, Q, B, D, R>,
      Q extends C2<C, Q, B, D, R>,
      B extends C3<C, Q, B, D, R>,
      D extends C4<C, Q, B, D, R>,
      R extends C5<R>> {
    interface I<T> {}
  }

  abstract static class C5<R2 extends C5<R2>> implements C7 {}

  interface C7 {}

  abstract static class C8<
      C extends C1<C, Q, B, D, CR>,
      Q extends C2<C, Q, B, D, CR>,
      B extends C3<C, Q, B, D, CR>,
      D extends C4<C, Q, B, D, CR>,
      CR extends C5<CR>,
      RpT extends C5<RpT>> {

    public static <
            C extends C1<C, Q, B, D, CR>,
            Q extends C2<C, Q, B, D, CR>,
            B extends C3<C, Q, B, D, CR>,
            D extends C4<C, Q, B, D, CR>,
            CR extends C5<CR>,
            RpT extends C5<RpT>>
        Builder<C, Q, B, D, CR, RpT> n(Q q) {
      throw new AssertionError();
    }

    abstract static class Builder<
        C extends C1<C, Q, B, D, CR>,
        Q extends C2<C, Q, B, D, CR>,
        B extends C3<C, Q, B, D, CR>,
        D extends C4<C, Q, B, D, CR>,
        CR extends C5<CR>,
        RpT extends C5<RpT>> {

      public abstract Builder<C, Q, B, D, CR, RpT> f(C9<?> x);

      public C8<C, Q, B, D, CR, RpT> b() {
        throw new AssertionError();
      }
    }
  }

  abstract static class C9<W extends C9<W>> {}

  static final class C10 extends C9<C10> {}

  abstract static class C11<W extends C9<W>, B extends C11<W, B>> {}

  static final class C12 extends C11<C10, C12> {

    public C10 b() {
      throw new AssertionError();
    }
  }

  static class C13 {

    public static final C12 n() {
      return new C12();
    }

    static final class C14 extends C1<C14, C15, C16, C17, C18> {}

    static final class C15 extends C2<C14, C15, C16, C17, C18> {}

    static final class C18 extends C5<C18> {}

    static class C17 extends C4<C14, C15, C16, C17, C18> implements C4.I<Long>, C19 {}

    static final class C16 extends C3<C14, C15, C16, C17, C18> {

      public C15 b() {
        throw new AssertionError();
      }
    }

    static final C16 q() {
      throw new AssertionError();
    }
  }

  interface C19 {}

  void f() {
    var x = C8.n(C13.q().b()).f(C13.n().b()).b();
  }
}
@smillst
Copy link
Member

smillst commented Jan 12, 2024

With master, this testcase cause a StackOverflowError on my machine.

@smillst smillst added the crash label Jan 12, 2024
@cushon
Copy link
Contributor Author

cushon commented Jan 12, 2024

With master, this testcase cause a StackOverflowError on my machine.

Does using a higher stack size for javac work around the StackOverflowError, i.e. javac -J-Xss7m ...?

@smillst
Copy link
Member

smillst commented Jan 12, 2024

With master, this testcase cause a StackOverflowError on my machine.

Does using a higher stack size for javac work around the StackOverflowError, i.e. javac -J-Xss7m ...?

Nope. I'll start working on fixing this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants