-
-
Notifications
You must be signed in to change notification settings - Fork 353
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Optimize ScalaJSModule and cache IRFileCache
#2783
Conversation
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.
Can you update the PR description to give me a clue?
Done ✅ |
@@ -150,14 +145,15 @@ class ScalaJSWorkerImpl extends ScalaJSWorkerApi { | |||
) | |||
else withModuleSplitStyle | |||
|
|||
StandardImpl.clearableLinker(withOutputPatterns) | |||
val linker = StandardImpl.clearableLinker(withOutputPatterns) | |||
val irFileCache = StandardImpl.irFileCache().newCache |
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.
The IRFileCache is capable to cache IR across different linker instances.
So ideally, you have a single instance of irFileCache()
in the entire build (and a newCache
per linker). This ensures that, for example, the Scala library is loaded only once. Otherwise you might see very high memory usage.
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.
Looks good to me, except the additional improvement suggested by @gzm0.
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.
Looks good to me. Thanks!
This PR contains various optimizations in
ScalaJSModule
andScalaJSWorkerImpl
.Changes:
sjsir
files andjar
files manually and let the Scala.js toolchain do it withPathIRContainer.fromClasspath(runClasspath)
passing the full runClasspathIRFileCache.Cache
together with the linker so it can be reused in multiple invocations offastLinkJS
Pull request: #2783