Vector successive insertion much faster than list
alecbenzer.com
Vector successive insertion much faster than list
1–3 of 3 posts
Re: Vector successive insertion much faster than list
#2As 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.
Re: Vector successive insertion much faster than list
#3As 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.
I'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).