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:
Welcome to Scala version 2.11.6 (Java HotSpot(TM) Server VM, Java 1.7.0_80).
Type in expressions to have them evaluated.
Type :help for more information.
scala> def foo[T: Numeric] = implicitly[miniboxing.runtime.math.MiniboxedNumeric[T]]
foo: [T](implicit evidence$1: Numeric[T])miniboxing.runtime.math.MiniboxedNumeric[T]
scala> def foo[T: Integral] = implicitly[miniboxing.runtime.math.MiniboxedIntegral[T]]
foo: [T](implicit evidence$1: Integral[T])miniboxing.runtime.math.MiniboxedIntegral[T]
scala> def foo[T: Fractional] = implicitly[miniboxing.runtime.math.MiniboxedFractional[T]]
foo: [T](implicit evidence$1: Fractional[T])miniboxing.runtime.math.MiniboxedFractional[T]
scala>