Description
When we profile one of our Spark jobs we saw that:
6.24% of the CPU is spend on List.length.
Scala List's length method is O(N) => https://github.com/scala/scala/blob/2.10.x/src/library/scala/collection/LinearSeqOptimized.scala#L36
Since we loop this method becomes O(N^2)