Optimize "for" cycle.