iterator optimization