Taming the performance Beast - Klaus Iglberger - Meeting C++ 2015
Why Stack Overflow recommends it
Stack Overflow users link it when answering questions about which C++ container to choose, since it shows measured performance of vector versus list and deque.
Recommended by 3 people across 3 different months, 2017 to 2021.
What it is
A Meeting C++ 2015 talk by Klaus Iglberger on writing fast C++ code, with a focus on how standard containers like vector, list and deque perform in practice. It covers cache effects, traversal costs and building sorted collections, backed by benchmarks.
What people said
Recommends David Scarlett · 2017-05 · Stack Overflow · on “Is list better than vector when we need to store "the last n items"?”
std::deque [LINK] is a far better option. Or if you had benchmarked std::deque and found its performance to be inadequate for your specific use, you could implement a circular buffer in a fixed size array, storing the index of the start of the buffer. When replacing an element in the buffer, you would overwrite the element at the start index, and then set the start index to its previous value plus one modulo the size of the buffer. List traversal is very slow, as list elements can be scattered throughout memory, and vector shifting is actually surprisingly fast, as memory moves on a single block of memory are quite fast even if it is a large block. The talk Taming The Performance Beast [VIDE
Recommends Henri Menke · 2018-05 · Stack Overflow · on “Writing performant C++ setters”
@shrpq It really depends what requirements you have for the container. If you only need to insert at the back as fast as possible, use `std::stack` [LINK] or `std::deque` [LINK] . I recommend watching this talk about the performance of standard containers: [this video]
Recommends fabian · 2021-06 · Stack Overflow · on “Use a std::vector or std::set for sorted and no duplicate elements?”
This (admittedly a few years old) presentation may shed some light on the matter: [this video] (building a sorted collection starts around 35 min in. (Traversal is addressed about 11 min in)