-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Assert in Run.scala is inefficient #2636
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
Comments
Move the assert after the declaration of the phases. Tested: Compiled one program and nothing blew up.
In #2640 (comment), Dmitry said this assert isn't on a hot path, so is it worth moving it? |
Yes I think so. I've seen a concrete example of people storing information in a phase and trying to retrieve it later, except the phase instance was overwritten by this assert, which was pretty difficult to figure out. |
Also, it's untrue that new runs are rarely created in the IDE: everytime you press a key a new run will be created. |
FTR: making phases a def was done intentionally, so that every run has new phases and phases don't have to carefully manage state between runs. |
Fix #2636: Move last phase period assertion
Uh oh!
There was an error while loading. Please reload this page.
Run.scala contains:
But
phases
is a def inCompiler
that will allocate every phase. This is pretty wasteful since we then throw away the result. We could probably move this assert inside the definition ofphases
, or at the point where we actually usephases
.The text was updated successfully, but these errors were encountered: