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

exponential compiler performance with nested pattern matches under tailrec transform #8893

Closed
scabug opened this issue Oct 7, 2014 · 3 comments
Assignees
Milestone

Comments

@scabug
Copy link

scabug commented Oct 7, 2014

object Test {
    def a(): Option[String] = Some("a")
 
    def main(args: Array[String]) {
        a() match {
            case Some(b1) =>
        a() match {
            case Some(b2) =>
        a() match {
            case Some(b3) =>
        a() match {
            case Some(b4) =>
        a() match {
            case Some(b5) =>
        a() match {
            case Some(b6) =>
        a() match {
            case Some(b7) =>
        a() match {
            case Some(b8) =>
        a() match {
            case Some(b9) =>
        a() match {
            case Some(b10) =>
        a() match {
            case Some(b11) =>
        a() match {
            case Some(b12) =>
        a() match {
            case Some(b13) =>
        a() match {
            case Some(b14) =>
        a() match {
            case Some(b15) =>
        a() match {
            case Some(b16) =>
        a() match {
            case Some(b17) =>
        a() match {
            case Some(b18) =>
        a() match {
            case Some(b19) =>
        a() match {
            case Some(b20) =>
        a() match {
            case Some(b21) =>
        a() match {
            case Some(b22) =>
        a() match {
            case Some(b23) =>
        a() match {
            case Some(b24) =>
        a() match {
            case Some(b25) =>
        a() match {
            case Some(b26) =>
        a() match {
            case Some(b27) =>
        a() match {
            case Some(b28) =>
        a() match {
            case Some(b29) =>
        a() match {
            case Some(b30) =>
                println("yay")
            case None => None
        }
            case None => None
        }
            case None => None
        }
            case None => None
        }
            case None => None
        }
            case None => None
        }
            case None => None
        }
            case None => None
        }
            case None => None
        }
            case None => None
        }
            case None => None
        }
            case None => None
        }
            case None => None
        }
            case None => None
        }
            case None => None
        }
            case None => None
        }
            case None => None
        }
            case None => None
        }
            case None => None
        }
            case None => None
        }
            case None => None
        }
            case None => None
        }
            case None => None
        }
            case None => None
        }
            case None => None
        }
            case None => None
        }
            case None => None
        }
            case None => None
        }
            case None => None
        }
            case None => None
        }
    }
}

See: https://twitter.com/dridus/status/519606670989590528

@scabug
Copy link
Author

scabug commented Oct 7, 2014

Imported From: https://issues.scala-lang.org/browse/SI-8893?orig=1
Reporter: @retronym
Affected Versions: 2.10.4, 2.11.2

@scabug
Copy link
Author

scabug commented Oct 7, 2014

@retronym said:
This fixes a constant factor along the way: https://github.com/retronym/scala/tree/topic/opt-tail-calls

But that's not the core problem.

@scabug
Copy link
Author

scabug commented Oct 8, 2014

@retronym said:
I think I've spotted the problem. I've pushed a few more commits to that branch.

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

No branches or pull requests

2 participants