This is the slow code
object Hello {
def main(args: Array[String]) = {
val ret = Array.fill[(Int, Int, Int)](8000000){(0, 0, 0)}
println(ret.size)
}
}
It runs for 2 minutes. And then outputs
java.lang.OutOfMemoryError: GC overhead limit exceeded
And this is the fast code
object Hello {
def main(args: Array[String]) = {
val ret = Array.fill[Int](24000000){0}
println(ret.size)
}
}
It runs for 0.5 seconds.
My compilation option:
scalac Hello.scala
Why is there a huge gap?