-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Have a per-run time budget for import suggestions #9167
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
Conversation
Keep a budget of import suggestions per run. The first timeout is 10sec. Each successive timeout is the previous timeout reduced by the search time of the previous suggestion search, but at least half the previous timeout.
Can we still roll this into 0.25? It would address a problem several people have come across. |
Can we make this configurable via a flag? An IDE for example might want to use a near-zero value or typecheck-as-you-type and increase it when idling. Additionally, is 10 seconds the right default? It seems quite high to me considering how many lines of code you could typecheck in that time. |
0.25.0-RC1 is already on maven, but we could make an 0.25.0-RC2 |
That way we escape the problem that implicit timeouts are reduced too much for later tests.
We now expose it as a var, which can be set by IDEs or other tools.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is good as a fast fix. However, the heap still goes up to 1GB and dotty.tools.dotc.core.Types$CachedAppliedType
count – to more than 4M on #9160:
I find it hard to believe we really need 4M objects when typechecking all those implicits...
Avoid referring to config option before it is initialized
@@ -87,6 +87,7 @@ class ScalaSettings extends Settings.SettingGroup { | |||
val XfatalWarnings: Setting[Boolean] = BooleanSetting("-Xfatal-warnings", "Fail the compilation if there are any warnings.") | |||
val XverifySignatures: Setting[Boolean] = BooleanSetting("-Xverify-signatures", "Verify generic signatures in generated bytecode.") | |||
val XignoreScala2Macros: Setting[Boolean] = BooleanSetting("-Xignore-scala2-macros", "Ignore errors when compiling code that calls Scala2 macros, these will fail at runtime.") | |||
val XimportSuggestionTimeout: Setting[Int] = IntSetting("-Ximport-suggestion-timeout", "Timeout (in ms) for searching for import suggestions when errors are reported.", 8000) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tgodzik You may want to set this timeout to a very low or even zero value when using the compiler from metals.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the hint! I think we can set it to 0 now, since we don't use that information in the IDE currently.
Keep a budget of import suggestions per run. The first timeout is 10sec.
Each successive timeout is the previous timeout reduced by the search time
of the previous suggestion search, but at least half the previous timeout.
Fixes #9160