Moving Faster: Everyday Efficiency in Modern C++

Rate this post

There seems to be a widely held belief among programmers today that efficiency no longer matters in most situations because processors are so fast and numerous and memory is so large. But from a user’s perspective computers are often slower today than they were 30 years ago despite the enormous increase in measured performance of the hardware. How can this be? If this is true, what are we doing wrong and what can we do about it? Is efficiency an everyday concern for working programmers, or is it only needed for special cases written by specialists?

In this talk we will explore these questions and consider the proposition that, contrary to popular belief, performance almost always matters and pervasive attention to efficiency is essential to ensure good performance. We will examine the efficiency tools modern C++ has to offer and discuss techniques for writing efficient code in an elegant, expressive and natural way. Topics will include tuning vs. optimizing, value semantics vs. reference semantics, unions and variants, move semantics, forwarding, container choice, in-place construction, and container node handling.


C++Now 2018


Alan Talbot


Original video was published with the Creative Commons Attribution license (reuse allowed).


Original video source:

Additional material for C++ learners:
Murach’s C++ Programming
C++ in One Hour a Day, Sams Teach Yourself (8th Edition)
A Tour of C++ (2nd Edition) (C++ In-Depth Series)
C# Programming Illustrated Guide For Beginners & Intermediates: The Future Is Here! Learning By Doing Approach

Tag: effective c++, c++, performance, fast c++, software development

Xem thêm: https://blogthủthuậ

Nguồn: https://blogthủthuậ


  1. "That guy down the hall that never opens his blinds, and has an editor that's green on black."
    That cuts way too close to home.

    set (not to mention unordered_set) has significant speed advantages over vector when dealing with large collections of unique values. vector with sort |> unique |> erase |> shrink_to_fit works better for small collections.

    I'd love to hear how execution policies effect things.

  2. At least in my code I quite like passing non const references.
    I program for robots a lot and quite like a sort of pipeline like:
    CollisionObject o;
    setPosition(o, x, y, z);
    setRotation(o, rx, ry, rz);
    addCOToScene(o, c);

  3. At least when I read C I know what the computer is doing.
    There's so much syntactic sugar here where subtle differences makes the computer do things very differently.
    It's a lot like JavaScript, in that in order to write performant code you need a deeper understanding of what the compiler is doing under-the-hood with what you've written.

  4. Wow this video is very humbling to me. I am a sophomore in college and I've recently learned how to program in c++. I really like it because you can maximize efficiency for your programs. Does anyone have any good references for someone somewhat new to c++ (I have a good grasp on all the basics) relating to maximizing the efficiency of programs? Book, youtube channel, blog, etc

  5. This talk has convinced me that sometimes it's worth paying for overhead if it makes it possible to actually understand wtf your code does.


Post Comment