Optimising C++

Course Description

Getting the best out of C++ requires understanding how modern machines work, how to measure code and how to use the standard library well. This 2-day hands-on course presents a measurement-based approach to performance and optimisation using C++11/14 on Linux, using tools such as gcc and valgrind.
2 Days
Contact us for pricing
Contact us for dates
Contact us for dates

Prerequisites

At least 3-6 months C++ programming experience.

Modern machines and cost of C++ features

Performance and modern machines
Measurement tools such as profilers, valgrind, cachgrind
Modern CPUs, caches, memory hierarchy, etc
Speed of various C++ features
Effect of data layout on performance
Cost of virtual functions
Inlining

C++11 move semantics

Lvalue and rvalue references
Move v. copy
Handle-based classes
What the compiler does for you
Rule of 3/5/zero
Resource management using smart pointers

Lookup and STL containers

Performance of STL containers
Insert and lookup
Container selection
Using domain knowledge for better optimisations
Data structures

Strings

Different approaches
Gcc v4 and v5 strings
Alternatives: string_view, arrays
Reducing memory allocations

Multi-threading concurrency

Dos and donts of multithreading
Performance problems caused by concurrency
How adding cores doesnt always add performance
The cost of contention
Context switching
Queue based systems
Amdahls Law
Concurrency libraries versus hand-rolled threads and locks

C++C++ Performance Tuning