jawn icon indicating copy to clipboard operation
jawn copied to clipboard

Enable scala2 inliner

Open mdedetrich opened this issue 2 years ago • 2 comments

I noticed that this project uses the @inline annotation which actually doesn't do anything unless you have the scala-2 inliner enable, quoting from https://docs.scala-lang.org/overviews/compiler-options/optimizer.html

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.

Ontop of this the PR splits out the implementation between Scala 2 and Scala 3. This is because Scala 3 hasn't ported the Scala 2 optimizer yet. Instead we use the inline keyword which for our intents and purposes achieves the same effect.

MiMa filters were added but this is for code that was marked private/internal use so it shouldn't be an issue.

mdedetrich avatar Jan 17 '24 13:01 mdedetrich

Is there any empirical evidence that the inliner helps here? Sometimes it even makes things worse.

rossabaker avatar Jan 28 '24 15:01 rossabaker

I did some testing but because I am overseas I only had my M1 pro which is notoriously difficult to benchmark especially when detecting minor performance improvements.

Ill be back at home in a few weeks and can re-run benchmarks on an actual desktop with locked clocks, will ping you then

mdedetrich avatar Jan 28 '24 21:01 mdedetrich