Optimize around the fact that pred_iterator is slow: instead of sorting