i was testing ruby, python and scala to see which one has better support for huge arrays.
Ruby (each) -> 84 MB, 2s # a = [];(0...1e7).each{|i| a[i]=i}
Ruby (expand) -> 254 MB, 60s #a = [*(0...1e7)]
Python (numpy) -> 95 MB, < 1s # a = np.arange(0, 1e7)
Python (range) -> 391 MB, < 1s # a = list(range(0, int(1e7)))
Scala (range) -> Memory Limit Exceeded :-) # var a = Range(0, 1e7.toInt).map(_.toInt)
as you can see, memory limit exceeds when using scala, what's the problem?!!!
--UPDATE
ok i should've used
var a = Array.range(0, 1e7.toInt)
but, what if i want to map the array to strings?
var b = a.map(_.toString())
Failure here...