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

Slow compilation for large pattern matching switch #2850

Closed
kevinychen opened this issue Aug 28, 2024 · 0 comments · Fixed by #2851
Closed

Slow compilation for large pattern matching switch #2850

kevinychen opened this issue Aug 28, 2024 · 0 comments · Fixed by #2851

Comments

@kevinychen
Copy link
Contributor

What happened?

Similar to #2328. This code snippet takes a very long time to compile (and so does the code snippet in the previous issue):

String id(Parent parent) {
    return switch (parent) {
        case Child1 child -> child.id();
        case Child2 child -> child.id();
        case Child3 child -> child.id();
        case Child4 child -> child.id();
        case Child5 child -> child.id();
        case Child6 child -> child.id();
        case Child7 child -> child.id();
        case Child8 child -> child.id();
    };
}

The 7-branch case only takes ~3s for me, but the 8-branch case takes ~20s, the 9-branch case takes ~3m, growing exponentially.

What did you want to happen?

This should take very little time.

Other notes

Just like #2328, this looks to also be due to the SafeLoggingPropagation check: each pattern matching variable child is considered a captured reference and recursively triggers an analysis here.

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

Successfully merging a pull request may close this issue.

1 participant