java.lang.reflect.Array.get/set performance

Ismael Juma mlists at
Fri Sep 10 12:12:48 UTC 2010

Hey all,

The approach used for Arrays in Scala was changed in 2.8 and initially 
java.lang.reflect.Array.get/set was used in certain cases. That was changed at 
the end of last year[1] after it was pointed out that the performance of those 
methods was less than desirable[2].

The interesting conclusion from that thread was that a simple instanceof check 
for each array type is faster than using java.lang.reflect.Array.get/set. Given 
those results, is there a good reason for not replacing the existing native 
methods with pure Java methods that simply use instanceof for each array type?



More information about the core-libs-dev mailing list