[ETCM-736] Enable compiler optimizations in Prod #963
Merged
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.
Description
Enable compiler inlining optimizations as described here https://www.lightbend.com/blog/scala-inliner-optimizer
See also documentation and options renaming ticket
Proposed Solution
-DmantisDev
and flagMANTISDEV
)Do we want to set it for tests and integration tests as well? Switching off dev mode might be a more clear way to achieve this...We agreed to keep it simple : production mode has optimization, dev mode does not, hence to test with inlinine toggle to production modeImportant Changes Introduced
Reminder
To enable dev mode,
-DmantisDev=true
orMANTIS_DEV=true
Ensuring that compile-time and run-time classpaths are the same
This section is kept for documentation purposes, it has been decided not to enable inline globally
Difference between the classpaths (on my machine, emptied caches)
sbt export compile:fullClasspath
)sbt export runtime:fullClasspath
)scala-collection-compat_2.13-2.3.2.jar
scala-collection-compat_2.13-2.1.6.jar
ScalaPb library is the only library depending on
scala-collection-compat
(latest 2.4.3) and it also imposes the version ofscala-collection-compat
to be used. Currently the project depends on ScalaPb0.10.9
which imposesscala-collection-compat_2.13-2.1.6
(https://github.com/scalapb/ScalaPB/blob/v0.10.9/project/Dependencies.scala#L13) whereas the latest is0.11.1
imposingscala-collection-compat-2.4.3
.Note : Monix also defines a dependency to
scala-collection-compat
via
Def.settings
https://github.com/monix/monix/blob/cb4823427db8b1f8fdf990bf27b307b396892a76/build.sbt#L89, this potentially explains the discrepancy between the classpaths.Potential solutions
-opt-inline-from:my.package.**
)Testing
"-Yopt-log-inline", "_"
option.compile:fullClasspath
vsruntime:fullClasspath