Loading repository data…
Loading repository data…
miniboxing / repository
Miniboxing is a program transformation that improves the performance of Scala generics when used with primitive types. It can speed up generic collections by factors between 1.5x and 22x, while maintaining bytecode duplication to a minimum. You can easily add miniboxing to your sbt project:
A transparent discovery signal based on current public GitHub metadata.
This score does not audit code, security, maintainers, documentation quality, or suitability. Verify the repository and its current documentation before adoption.
Miniboxing is a Scala compiler transformation that improves the performance of generics for primitive numeric types. Unlike specialization, miniboxing reduces the amount of generated bytecode without sacrificing execution speed, therefore being capable of transforming the Scala collections hierachy.
Short answer: because it matches the performance of specialization, without the bytecode blowup. For the Tuple3 class:
case class Tuple3[@specialized +T1, @specialized +T2, @specialized +T3](_1: T1, _2: T2, _3: T3)
Specialization generates 1000 classes. Just change @specialized to @miniboxed and you get only 8 classes.
Long answer: Aside from reducing the bytecode size, the miniboxing technique improves several other aspects of specialization:
To see the benchmarks we performed, have a look at the OOPSLA 2013 paper we just prepared. They include performance evaluations, bytecode size comparisons and many more. Also, the docs directory contains a series of papers and presentations which explain many aspects of the miniboxing transformation.
At this point, the miniboxing plugin is not production-ready, although it can compile spire. However, we do publish a nightly maven artifact on Sonatype, so anyone can try the current transformation. To get started, have a look at the example project we prepared.
Mind the gap: there are still many bugs and known limitations, so you're in for a thrill! Also, don't hesitate to add bugs to the tracker, good reductions that can be easily reproduced are highly appreciated!
The wiki is a good place to start looking into installing, testing, benchmarking and hacking on the miniboxing plugin. Also have a look at the docs directory, which contains some good resources.
The development branches are:
components/plugin - the actual Scala compiler plugincomponents/runtime - the runtime support for the transformed codecomponents/classloader - the classloader used for runtime class specializationtests/benchmarks - the benchmarks for the projecttests/correctness - the tests for the plugin transformationdocs - documents released as the development goes onIf you have any question, you can contact me at vlad dot ureche at epfl dot ch.