diff options
author | Guillaume Martres <smarter@ubuntu.com> | 2014-11-13 17:18:53 +0100 |
---|---|---|
committer | Guillaume Martres <smarter@ubuntu.com> | 2014-11-17 18:54:41 +0100 |
commit | b73ea2fde3949bcd1366cc8778c007619b627481 (patch) | |
tree | 85a678f53e1a70906e9083f2b3ff6ab986f4ae91 | |
parent | 7978a5f6a1be13ca9c482c3f2e9c2102018cfcf0 (diff) | |
download | dotty-b73ea2fde3949bcd1366cc8778c007619b627481.tar.gz dotty-b73ea2fde3949bcd1366cc8778c007619b627481.tar.bz2 dotty-b73ea2fde3949bcd1366cc8778c007619b627481.zip |
Add option to optimize the JVM for short-runnning applications
Ideally, dotc should reuse a resident compiler and we should not fork sbt
for every task. Until this happens, this option is useful for
development. Fixes #222.
Usage:
$ sbt -DOshort=""
$ ./bin/dotc -Oshort foo.scala
-rwxr-xr-x | bin/dotc | 3 | ||||
-rw-r--r-- | project/Build.scala | 9 |
2 files changed, 11 insertions, 1 deletions
@@ -185,6 +185,9 @@ case "$1" in -d|-debug) debug=true && shift ;; -q|-quiet) quiet=true && shift ;; + # Optimize for short-running applications, see https://github.com/lampepfl/dotty/issues/222 + -Oshort) addJava "-XX:+TieredCompilation -XX:TieredStopAtLevel=1" && shift ;; + -repl) main_class=$ReplMain && shift ;; -compile) main_class=$CompilerMain && shift ;; -run) main_class=$ReplMain && shift ;; diff --git a/project/Build.scala b/project/Build.scala index 33a09a4f7..9e2633136 100644 --- a/project/Build.scala +++ b/project/Build.scala @@ -68,7 +68,14 @@ object DottyBuild extends Build { else List() - agentOptions ::: travis_build ::: fullpath + val tuning = + if (sys.props.isDefinedAt("Oshort")) + // Optimize for short-running applications, see https://github.com/lampepfl/dotty/issues/222 + List("-XX:+TieredCompilation", "-XX:TieredStopAtLevel=1") + else + List() + + tuning ::: agentOptions ::: travis_build ::: fullpath } ) |