https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110060
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> --- (In reply to Jonathan Wakely from comment #2) > Anything I can do in std::vector to make it optimize better? I don't think in this case there is but I could be wrong. it has to do with the v.insert call saving the end value and then loading from it and doing a comparison and it is iterative on it (with a few v.insert).