Skip to content

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

Notifications You must be signed in to change notification settings

GiovanniDicanio/StlVectorVsListPerformance

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages