- About Scala
- Documentation
- Code Examples
- Software
- Scala Developers
Why is Tuple only specialized for Int, Long and Double?
Fri, 2010-07-30, 06:37
Hello everybody,
I'm working on a computation-intensive program where I use Tuple2[Float, Float] a lot. I looked at the source code of the Scala library (2.8.0.final) and I see that Tuple2 is partially specialized:
case class Tuple2[@specialized(Int, Long, Double) +T1, @specialized(Int, Long, Double) +T2](_1:T1,_2:T2) extends Product2[T1, T2]
It's not specialized for Float, so my program doesn't take advantage of the specialization.
Why are tuples only specialized for Int, Long and Double and not for the other "primitive" types? And why the choice for Int, Long and Double?
-- Jesper de Jong | jespdj@gmail.com
I'm working on a computation-intensive program where I use Tuple2[Float, Float] a lot. I looked at the source code of the Scala library (2.8.0.final) and I see that Tuple2 is partially specialized:
case class Tuple2[@specialized(Int, Long, Double) +T1, @specialized(Int, Long, Double) +T2](_1:T1,_2:T2) extends Product2[T1, T2]
It's not specialized for Float, so my program doesn't take advantage of the specialization.
Why are tuples only specialized for Int, Long and Double and not for the other "primitive" types? And why the choice for Int, Long and Double?
-- Jesper de Jong | jespdj@gmail.com
On Fri, Jul 30, 2010 at 7:37 AM, Jesper de Jong <jespdj@gmail.com> wrote: