optimize IList#span, splitAt, takeWhile