Hoist vector.size() computation out of the loop. No functionality change.