Optimize reuse of iterations in repetition