Re performance.
Comparing performance I see unexpected results - any comments on the following.
Counting up with Int
for ( i:Int <- 0 to 500000000) { }
took 859ms
Counting up with Long is massively slower ..
for ( i: Long <- 0L to 500000000L) {}
took 5000ms
Counting down is much faster and about same timing with int or long
for ( i:Int <- 500000000 to 0 ) {}
took 341ms
for ( i:Long <- 500000000L to 0L ) {}
took 343ms
CPU : Core i5 M520
Scala 2.9.1
Tried while loop too ..
Count up or down with int took 2 ms
Count up/down with long took 632/431ms
The while test were variants of ..
var i:Long = 500000000L
while ( i > 0L ) {
i -= 1
}
Edited 2 time(s). Last edit at 12/24/2011 01:05AM by johnlon.