Thursday 18th June, 2015
1:40pm to 2:30pm
Generics on the Java Virtual Machine perform suboptimally for primitive values, such as integers and floating-point numbers, due to the boxing overhead. This forces programmers to choose between code reuse and performance, not being able to have both at the same time. So far, this led to the creation of many primitive collection libraries, each with its own incompatible API. And it even permeated the Java 8 API, resulting in 43 incompatible functional interfaces instead of a single generic function, only to avoid primitive boxing.
In this talk I will present miniboxing, a compilation technique that allows generics to efficiently handle both objects and primitive types. From the programmer's perspective, the transformation is completely automated and the results are stunning: in a live-coding session we will show how miniboxing speeds up a simple Vector collection by 5x using only an annotation and by another 2x by slightly rewriting the code, following the compiler's guidance. The miniboxing transformation is available as an open-source, ready-to-use Scala compiler plugin, described on the scala-miniboxing.org website.
ScalaTeam @EPFL, author of the @miniboxing plugin (http://scala-miniboxing.org). Interested in compilers and virtual machines. Dreaming of starting my own business. bio from Twitter
Sign in to add slides, notes or videos to this session