Hi everybody,
I�m trying to understand why is the reason that there is a slight performance difference between these two loops:
for ( int i = 0; i < 10000000; i++ ){
String s = ""+i;
Long myLong = new Long(s);
long l = myLong.longValue();
}
for ( int i = 0; i < 10000000; i++ ){
String s = ""+i;
long l = Long.parseLong(s);
}
On my machine, the loop using the longValue() method is about 10 % slower than the one that uses the parseLong() method.
Is that because parseLong is static ?
or is that because of the new Long() instanciation ?
Thanks for your answers.
Cheers - Nicolas