-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Reduce IO calls in extractDependencies #18266
Conversation
test performance please |
performance test scheduled: 207 job(s) in queue, 1 running. |
@@ -262,6 +262,19 @@ object Contexts { | |||
/** AbstractFile with given path, memoized */ | |||
def getFile(name: String): AbstractFile = getFile(name.toTermName) | |||
|
|||
def getSiblingClassfile(tastyFile: AbstractFile): AbstractFile = | |||
base.siblingClassfiles.getOrElseUpdate(tastyFile, { |
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.
we could possibly check before caching to see if Zinc is enabled.
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.
Did you check how many cache hits we get?
Performance test finished successfully: Visit https://dotty-bench.epfl.ch/18266/ to see the changes. Benchmarks is based on merging with main (7613234) |
note that the sbt phases are not ran in the benchmark |
e4d25ef
to
314e731
Compare
is there any objection to adding new caches to |
@@ -262,6 +262,19 @@ object Contexts { | |||
/** AbstractFile with given path, memoized */ | |||
def getFile(name: String): AbstractFile = getFile(name.toTermName) | |||
|
|||
def getSiblingClassfile(tastyFile: AbstractFile): AbstractFile = | |||
base.siblingClassfiles.getOrElseUpdate(tastyFile, { |
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.
Did you check how many cache hits we get?
Not sure if that is a good idea. @smarter WDYT? |
// did not find associated class file, e.g. for a TASTy-only classpath. | ||
// The file that Zinc recieves with binaryDependency is used to lookup any either any | ||
// generated non-local classes or produced xsbti.API associated with the file. |
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.
Does incremental compilation works at all with a tasty-only classpath? What happens if we just always pass to sbt the name of a .class file even if it doesn't exist?
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.
What happens if we just always pass to sbt the name of a .class file even if it doesn't exist?
I guess that would lead to overcompilation:
https://github.com/lampepfl/dotty/blob/a73316af791502b82525471816fe9153c36f845a/compiler/src/dotty/tools/dotc/core/SymDenotations.scala#L536-L540
But what happens if we pass the .tasty file instead?
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.
We decided that whatever we record as the binaryDependency will need to be emitted eventually as a real class file with generatedNonLocalClass
dd5d0df
to
1e5ac78
Compare
1e5ac78
to
529eaf4
Compare
one CI failure so far for ea75836 ( |
91e2b7e
to
daf159c
Compare
daf159c
to
2dfc28f
Compare
performance test scheduled for githubcomlampepfldottypull18266commits2dfc28ff27c14e33cf110456a7ddb6b596fb4525: 92 job(s) in queue, 1 running. |
performance test failed: Please check https://dotty-bench.epfl.ch/logs/ for more information |
@bishabosha Does this also need to wait for #17594 backport? |
that's right |
fix two hotspots in extractDependencies - checking if
depFile
is a class, (does file IO onisDirectory
), and resolving sibling class file of a TASTy file (more file IO).To fix this, only check the file extension, and also avoid unnecessary resolving of sibling
.class
file (always failing) when we have a.scala
file as the associated file.Second we can cache the associated class file of a TASTy file.
before:
after:
as you can see
recordClassDependency
after optimisation is now completely dominated by calling to zinc