You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit cd176f9
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: _overviews/compiler-options/optimizer.md
+3-1Lines changed: 3 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,6 +15,8 @@ By **[Lukas Rytz](https://github.com/lrytz) (2018)**, **[Andrew Marki](https://g
15
15
as it breaks binary compatibility, prevents the use of newer dependencies, and breaks incremental compilation.
16
16
- The typical way to enable the optimizer is with the compiler arguments `-opt -opt-inline:**,!java.**`,
17
17
which enables local optimizations and allows inlining of anything not in the JDK itself.
18
+
- When compiling an application with such global inlining, ensure that the run-time classpath is **exactly the same** as the compile-time classpath.
19
+
- Alternatively, use `-opt:inline:my.package.**` to only inline from packages within your library, or within libraries you control.
18
20
- The optimizer's main focus is to _inline_ functions and methods that are considered worth inlining, in particular higher-order functions.
19
21
You can tell the inliner to always inline a specific method with the `@inline` annotation and to never do so with the `@noinline` annotation,
20
22
but you should normally not need these annotations.
@@ -105,7 +107,7 @@ The reason for this restriction is that dependency management tools like sbt wil
105
107
## Using and interacting with the optimizer
106
108
107
109
There are two compiler flags you should know about:
108
-
-`-opt` enables local optimizations. While these do not break binary compatibility and can always be used, they typically do not improve performance on their own, such as:
110
+
-`-opt` enables local optimizations. While these do not break binary compatibility and can always be used, they typically do not improve performance on their own.
109
111
- Elimination of code that loads unused values
110
112
- Rewriting of null and `isInstanceOf` checks whose result is known at compile-time
111
113
- Elimination of value boxes like `java.lang.Integer` or `scala.runtime.DoubleRef` that are created within a method and don't escape it
0 commit comments