tl;dr.
- Don't inline from your dependencies when publishing a library, it breaks binary compatibility. Use
-opt-inline-from:my.package.**
to only inline from packages within your library. - When compiling with the inliner enabled, ensure that the run-time classpath is exactly the same as the compile-time classpath.
- Don't enable the optimizer for development: it breaks sbt's incremental compilation, and it makes the compiler slower. Only enable it for testing, on CI and to build releases.
- The
@inline
annotation only has an effect if the inliner is enabled. It tells the inliner to always try to inline the annotated method or callsite. - Without the
@inline
annotation, the inliner generally inlines higher-order methods and forwarder methods. The main goal is to eliminate megamorphic callsites due to functions passed as argument, and to eliminate value boxing. Other optimizations are delegated to the JVM.