Skip to content

Exponential compilation time of "1" + 1 + "1" + ... #1687

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

Closed
OlivierBlanvillain opened this issue Nov 8, 2016 · 3 comments
Closed

Exponential compilation time of "1" + 1 + "1" + ... #1687

OlivierBlanvillain opened this issue Nov 8, 2016 · 3 comments

Comments

@OlivierBlanvillain
Copy link
Contributor

The following complies in 11s:

object O {
  def f: String = {
    "1" + 1 + "1" + 1 +
    "1" + 1 + "1" + 1 +
    "1" + 1 + "1" + 1 +
    "1" + 1 + "1" + 1 +
    "1" + 1 + "1" + 1 +
    "1" + 1 + "1" + 1
  }
}
@DarkDimius
Copy link
Contributor

@OlivierBlanvillain in which phase is it spending time? is it tailrec?

@OlivierBlanvillain
Copy link
Contributor Author

Yes it's spending time in tailrec doing lots of isSubType calls

@DarkDimius DarkDimius self-assigned this Nov 9, 2016
@DarkDimius
Copy link
Contributor

Thanks for minimizing. I'll have a look at this after PLDI deadline.

OlivierBlanvillain added a commit to OlivierBlanvillain/scalatest that referenced this issue Nov 9, 2016
OlivierBlanvillain added a commit to OlivierBlanvillain/scalatest that referenced this issue Nov 10, 2016
DarkDimius added a commit to dotty-staging/dotty that referenced this issue Jan 22, 2017
The b-test would compile for a millenia without the fix.
DarkDimius added a commit that referenced this issue Jan 28, 2017
Fix #1687: postpone computations in tailrec until they are needed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants