Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add scalac inliner options for Scala 2 #2808

Merged
merged 1 commit into from
Aug 24, 2023

Conversation

mdedetrich
Copy link
Contributor

@mdedetrich mdedetrich commented Aug 23, 2023

The latest version of the Scala 2 inliner is considered to be safe and stable and we can also inline away the slick.compat.* code since its private and never meant to be called by users of slick.

Note that the @inline annotation currently doesn't do anything unless you actually enable the inliner, i.e.

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.

from https://docs.scala-lang.org/overviews/compiler-options/optimizer.html

@github-actions
Copy link
Contributor

Incompatible changes

slick

3 changes since 3.5.0-pre.62.ed0ba56a

Code changes

Incompatibility Symbol Problem
Backward slick.compat.collection.package MissingClassProblem

class slick.compat.collection.package does not have a correspondent in current version

Backward slick.compat.collection.package$ MissingClassProblem

object slick.compat.collection.package does not have a correspondent in current version

Backward slick.compat.collection.package$JavaConverters$ MissingClassProblem

object slick.compat.collection.package#JavaConverters does not have a correspondent in current version

@github-actions
Copy link
Contributor

Incompatible changes

slick

3 changes since 3.5.0-pre.62.ed0ba56a

Code changes

Incompatibility Symbol Problem
Backward slick.compat.collection.package MissingClassProblem

class slick.compat.collection.package does not have a correspondent in current version

Backward slick.compat.collection.package$ MissingClassProblem

object slick.compat.collection.package does not have a correspondent in current version

Backward slick.compat.collection.package$JavaConverters$ MissingClassProblem

object slick.compat.collection.package#JavaConverters does not have a correspondent in current version

@nafg
Copy link
Member

nafg commented Aug 24, 2023

What is the benefit of doing this?

@mdedetrich
Copy link
Contributor Author

What is the benefit of doing this?

Its best to read https://docs.scala-lang.org/overviews/compiler-options/optimizer.html but in summary the inliner produces code that is much better optimized for the JVM. Put differently there is almost never a reason not to use the inliner.

Also specifically for in the case of the slick compat that was added previously, its going to remove all of the forwarder functions (i.e.

private[slick] implicit def genericCompanionToCBF[A, CC[X] <: GenTraversable[X]]
(fact: GenericCompanion[CC]): CanBuildFrom[Any, A, CC[A]] =
simpleCBF(fact.newBuilder[A])
will get inlined to just call simpleCBF(fact.newBuilder[A]) directly, i.e. it makes it cost free

@nafg nafg merged commit 8876f3d into slick:main Aug 24, 2023
12 checks passed
@mdedetrich mdedetrich deleted the add-inliner-for-scala2 branch August 24, 2023 23:20
@nafg nafg added this to the 3.5.0 milestone Nov 20, 2023
@nafg nafg added the build Change to the build definition and dependencies label Nov 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Change to the build definition and dependencies
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants