miniboxing / miniboxing-plugin

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:
http://scala-miniboxing.org
Other
121 stars 17 forks source link

Issue #227 - Add implicit creator for MbNumeric object #231

Closed milosstojanovic closed 9 years ago

milosstojanovic commented 9 years ago
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>
VladUreche commented 9 years ago

Awesome work @milosstojanovic! Can you add the example above as a test?

VladUreche commented 9 years ago

With the test, LGTM!

milosstojanovic commented 9 years ago

Test added

VladUreche commented 9 years ago

LGTM! :+1: