Avoid typechecking val and def tpt-s twice#8075
Merged
retronym merged 1 commit intoscala:2.12.xfrom May 21, 2019
Merged
Conversation
Member
Author
|
The performance benefit here is likely imperceptible in normal compilation as typechecking types is typically quick. However, in my work on "outline typing" at the moment, the profiles led me to notice this inefficiency. |
lrytz
approved these changes
May 20, 2019
Demo:
```
$ cat sandbox/test.scala && (scalac-ref 2.12.x -Ytyper-debug sandbox/test.scala 2>&1) > /tmp/old.log && (qscalac -Ytyper-debug sandbox/test.scala 2>&1) > /tmp/new.log && diff -U1000 /tmp/{old,new}.log
```
```scala
trait C {
type X
def foo: X
}
```
```diff
--- /tmp/old.log 2019-05-20 13:56:45.000000000 +1000
+++ /tmp/new.log 2019-05-20 13:56:47.000000000 +1000
@@ -1,12 +1,10 @@
|-- <empty> EXPRmode-POLYmode-QUALmode (site: package <root>)
+|-- <empty> EXPRmode-POLYmode-QUALmode (site: package <root>)
| \-> <empty>.type
|-- class C BYVALmode-EXPRmode (site: package <empty>)
| |-- X BYVALmode-EXPRmode (site: trait C)
| | \-> [type X] C.this.X
| |-- def foo BYVALmode-EXPRmode (site: trait C)
| | |-- X TYPEmode (site: method foo in C)
| | | \-> C.this.X
-| | |-- X TYPEmode (site: method foo in C)
-| | | \-> C.this.X
| | \-> [def foo] => C.this.X
| \-> [trait C] C
```
4477a74 to
7806650
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Demo: