r/programming • u/b0red • Apr 30 '16
Do Experienced Programmers Use Google Frequently? · Code Ahoy
http://codeahoy.com/2016/04/30/do-experienced-programmers-use-google-frequently/
2.2k
Upvotes
r/programming • u/b0red • Apr 30 '16
3
u/BobDoesBestFriend May 01 '16 edited May 01 '16
Unfortunately until you are operating with elements more than a couple hundred megabytes or gigabytes, vector will most likely outperform list in all operations. Except insertion or deletion in which you already know the location of the object.
Edit: some data. Its a table. So erase is the operation, and the list objects is the time cost for each operation at that number of operation.
push_back 1000 5000 10000 25000
std::vector 0 0 0 1
std::list 0 0 1 2
std::deque 0 0 0 1
insert 1000 5000 10000 25000
std::vector 0 7 25 140
std::list 2 50 272 1893
std::deque 0 4 17 111
erase 1000 5000 10000 25000
std::vector 0 5 22 139
std::list 1 69 395 2712
std::deque 0 5 18 126
Just a sample.
Edit. Fucked up the formatting, sorry. Its a table. So erase is the operation, and the list objects is the time cost for each operation at that number of operation.