Script startup latency improvement #11660
Closed
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.
When launching a scala3 script, there are two calls to dist/bin/common, the first from within dist/bin/scala and the 2nd when
dist/bin/scala
callsdist/bin/scalac
.It turns out that the avoidable 2nd call is quite expensive in terms of what it adds to script startup latency. Here are the reductions in startup time when running in
cygwin
and inWSL Linux
:The numbers are the difference in startup latency for calling a
hello-world.sc
script with and without the changes in this PR, averaged over 100 runs.The categories of change in the PR are:
dist/bin/common
and required by scalacdist/bin/scalac
to conditionally sourcedist/bin/common
set -o nounset
The third change is exemplified by line 114 in
dist/bin/common
: