Seven years ago, specialization arrived in Scala, offering a way to improve the performance of methods called with primitive values, thanks to Iulian Dragos. We have learned a lot since then, so it's time to revisit the topic.
The Dotty Linker analyses your program and its dependencies to apply a new specialization scheme. It builds on our experience from Specialization, Miniboxing and the Valhalla Project, and can drastically reduce the size of the emitted bytecode. And, best of all, it's always on, happens behind the scenes without annotations, and can produce speedups in excess of 20x. Additionally, it "just works" on Scala collections.