Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Vector successive insertion much faster than list (alecbenzer.com)
2 points by alecbenzer on Aug 5, 2011 | hide | past | favorite | 2 comments


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.


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).




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: