scala/scala — pull request #2676 by soc (2013-06-23 15:36:50+00:00)
Title: SI-7511 Remove indirection of numeric methods

Methods on `Rich`s like `abs`, `doubleValue`, `floatValue`,
`longValue`, `intValue`, `byteValue`, `shortValue`, `min`, `max`,
`signum` are slow because they go through multiple indirections
including typeclasses and boxing.

For instance, take `1L.abs`:

Instead of just computing and returning the result (like it is done in
`RichInt`), this is what happens:

- `RichLong` inherits `abs` by extending `ScalaNumberProxy[T]`
- `ScalaNumberProxy[T]` has an abstract
`protected implicit def num: Numeric[T]`
- This method is implemented in `RichLong` and points to
`scala.math.Numeric.LongIsIntegral`
- The actual method `abs` now calls `num.abs(self)`