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