Skip to content

Commit 2999dde

Browse files
[ETCM-736] Enable compiler optimizations in Prod (#963)
* [ETCM-736] Enable compiler optimizations in Prod See https://www.lightbend.com/blog/scala-inliner-optimizer To display optimizations logs : add `"-Yopt-log-inline", "_"` * [ETCM-736] Restrict inlining to the project * Update nix patch Co-authored-by: Jonathan Ringer <[email protected]>
1 parent 25c3966 commit 2999dde

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

build.sbt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ val nixBuild = sys.props.isDefinedAt("nix")
1212
// Enable dev mode: disable certain flags, etc.
1313
val mantisDev = sys.props.get("mantisDev").contains("true") || sys.env.get("MANTIS_DEV").contains("true")
1414

15+
lazy val compilerOptimizationsForProd = Seq(
16+
"-opt:l:method", // method-local optimizations
17+
"-opt:l:inline", // inlining optimizations
18+
"-opt-inline-from:io.iohk.**" // inlining the project only
19+
)
20+
1521
// Releasing. https://github.com/olafurpg/sbt-ci-release
1622
inThisBuild(List(
1723
organization := "io.iohk",
@@ -47,6 +53,7 @@ def commonSettings(projectName: String): Seq[sbt.Def.Setting[_]] = Seq(
4753
"-encoding",
4854
"utf-8"
4955
),
56+
scalacOptions ++= (if (mantisDev) Seq.empty else compilerOptimizationsForProd),
5057
scalacOptions in (Compile, console) ~= (_.filterNot(
5158
Set(
5259
"-Ywarn-unused-import",

nix/protoc.patch

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
diff --git a/build.sbt b/build.sbt
2-
index 6bf2b25cb..155de447d 100644
2+
index 4ac21ff40..ccd34412e 100644
33
--- a/build.sbt
44
+++ b/build.sbt
5-
@@ -25,6 +25,7 @@ def commonSettings(projectName: String) = Seq(
6-
"-encoding",
7-
"UTF-8"
8-
),
5+
@@ -43,6 +43,7 @@ def commonSettings(projectName: String): Seq[sbt.Def.Setting[_]] = Seq(
6+
scalaVersion := `scala-2.13`,
7+
// Scalanet snapshots are published to Sonatype after each build.
8+
resolvers += "Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots",
99
+ PB.runProtoc in Compile := (args => Process("@protobuf@/bin/protoc", args)!),
10-
scalacOptions in (Compile, console) ~= (_.filterNot(
11-
Set(
12-
"-Ywarn-unused-import",
10+
testOptions in Test += Tests
11+
.Argument(TestFrameworks.ScalaTest, "-l", "EthashMinerSpec"), // miner tests disabled by default,
12+
scalacOptions := Seq(

0 commit comments

Comments
 (0)