`foreach` with `case` is actually pretty slow in Scala, as it does an isInstanceOf and other funny stuff to do pattern matching inside. It would be better to do `iter.foreach { p => ...` and use `p._1` and `p._2`.