GiovanniDicanio / StlVectorVsListPerformance

C++ benchmarks, comparing the performance of STL's std::vector vs. std::list.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Insertion/Remove Performance of std::vector vs. std::list

by Giovanni Dicanio

2014, April 6th

This repository contains a couple of benchmarks, to compare insertion and remove performance for std::vector vs. std::list, for integer elements.

std::vector does much better than std::list!
Its contiguous memory allocation pattern is great performance-wise, if compared to std::list node-based allocation.

std::vector vs. std::list performance in Excel

See the commented C++ sources for details on the benchmarks.

Consider also watching this interesting talk "Modern C++: What You Need to Know" from Build 2014.

PS
I wrote the benchmarks using Notepad2 as editor, and compiled from the command line. For convenience, I then wrapped the code in a VS2013 solution.
However, it's still possible to compile directly from the command line (see the comments in the source codes for details about that).

About

C++ benchmarks, comparing the performance of STL's std::vector vs. std::list.


Languages

Language:C++ 100.0%