title: performance: ruby CSV.foreach vs CSV.parse
body: <p>I'm not sure this question is related to ruby only, maybe you'll find it relevant to any other language. </p>
  
  <p>I wonder if I should use parse or foreach:</p>
  
  <ul>
  <li><p><code>CSV.parse(filepath)</code> will parse the entire file and return an array of arrays, that will reflect the csv file and will be stored in the memory. Later, I'll process this array rows.</p></li>
  <li><p><code>CSV.foreach(filepath)</code> will read/parse the file row-by-row and process it row-by-row. </p></li>
  </ul>
  
  <p>When it comes to performance, is there any difference? is there a preferable approach? </p>
  
  <p>PS: I know that in ruby I can provide a block with the parse method and then it will handle each row separately.  </p>