7 ms·
As with everything, it depends. If you have large data structures then the overhead of a vector's over-allocation and eventual copying (possibly multiple times)
by jesstaa 15y ago
As with everything, it depends.
If you have large data structures then the overhead of a vector's over-allocation and eventual copying (possibly multiple times) might be an issue.
- matthewnourse 15y agoI'd love to see where the crossover point is on different architectures...especially when the size of the collection is just over the CPU's L1 cache size. I wonder if the vector's 1-or-many cache miss(es) would exceed the cost of the list's guaranteed-one-or-two cache miss(es).