Do not use an Iterator inside a hot loop

Change from an iterator generating allocations inside a hot loop to a
simple for loop.