https://baptiste-wicht.com/posts/2012/12/cpp-benchmark-vector-list-deque.html


To conclude, we can get some facts about each data structure:

  • std::list is very very slow to iterate through the collection due to its very poor spatial locality.
  • std::vector and std::deque perform always faster than std::list with very small data
  • std::list handles very well large elements
  • std::deque performs better than a std::vector for inserting at random positions (especially at the front, which is constant time)
  • std::deque and std::vector do not support very well data types with high cost of copy/assignment

This draw simple conclusions on usage of each data structure:

  • Number crunching: use std::vector or std::deque
  • Linear search: use std::vector or std::deque
  • Random Insert/Remove:
    • Small data size: use std::vector
    • Large element size: use std::list (unless if intended principally for searching)
  • Non-trivial data type: use std::list unless you need the container especially for searching. But for multiple modifications of the container, it will be very slow.
  • Push to front: use std::deque or std::list

일단은 참고