Martin's comments on "Any[] array" performance

Thomas W at
Mon Jan 5 22:36:16 UTC 2015

Hi Martin, people,

Just as an aside, I was interested by your comments on "Any arrays" --
Any[] or []T in Scala.

This is a bit of a vexed performance area, I'm just thinking it might be
worth a look at how native libraries, bytecode, or VM can support this
access in a more performant manner.

> problem arises for []T, where T is an unbounded type variable. We erase
[]T to Object. It does
> not run super-fast now (performance hit of about a factor of 10-20
compared to
> native array access),  but it looks easy to optimize if the JVM is aware
of it.

Not sure if it will be relevant to our specialization efforts directly, but
we are talking about this area. Could it be worth a look?

Thomas Whitmore

More information about the valhalla-dev mailing list