If the speed gain is small, I would plainly wrote the second alternative in the loop.