optimizations in unary_iterator