http://www.baptiste-wicht.com/2012/11/cpp-benchmark-vector-vs-list/
作者は実際に測定を行い、こう結論しています。
- std::vector is insanely faster than std::list to find an element
- std::vector performs always faster than std::list with very small data
- std::vector is always faster to push elements at the back than std::list
- std::list handles very well large elements, especially for sorting or inserting in the front
- Number crunching: use std::vector
- Linear search: use std::vector
- Random Insert/Remove: use std::list (if data size very small (< 64B on my computer), use std::vector)
- Big data size: use std::list (not if intended for searching)
0 件のコメント:
コメントを投稿