title: which is faster in spark, collect() or toLocalIterator()
body: <p>I have a spark application in which I need to get the data from executors to driver and I am using <code>collect()</code>. However, I also came across <code>toLocalIterator()</code>. As far as I have read about <code>toLocalIterator()</code> on Internet, it returns an iterator rather than sending whole RDD instantly, so it has better memory performance, but what about speed? How is the performance between <code>collect()</code> and <code>toLocalIterator()</code> when it comes to execution/computation time?</p>