Workshop: C++ Performance and Optimisation
This two-day course is designed to give developers an appreciation of how to achieve better performance from their C++ code. It covers a wide range of topics from how modern machines work through how best to lay out data, which containers to use, and when multi-threading is helpful.
This course is based on Linux tools – there is no equivalent Windows-based course. An online Linux environment can be provided if necessary.
Day 1 – morning
- Measurement and big-O notation
- Factors that drive performance in modern machines
- Memory hierarchy and caching
- Function inlining and virtuals
- Branch prediction
- Data layout
- Compiler optimisations
Day 1 – afternoon
- Value and move semantics, Rule of 3/5/zero
- RVO, lifetime management, RAII, wrappers
- Unique and shared pointers
- Emplacement semantics
Day 2 – morning
- STL containers and other containers (flat sets/maps)
- Performance, memory, insertion and search
- Dense linear access
- Read and write amplification
- Six questions about data
- Operational profile
- Performance tradeoffs
Day 2 - afternoon
- Alternative approaches to string handling
- Dos and don’ts of multithreaded programming
- Key takeaway points
This course is suitable for programmers with a basic knowledge of C++ and the STL.
Knowledge of C++, preferably C++11.
Access to a Linux or Mac system (a suitable online system can be provided if required). Minimum compiler versions: g++ 4.9, clang 3.6.
Hubert Matthews has been programming in C++ for over 15 years and he has been teaching it for over 10 years. He also works as a systems architect and software consultant. Hubert has been a member of the UK BSI standards committee for C++. Hubert Matthews is a freelance consultant specialising in system architecture and design as well as training programmers in C++, UML and Java. His clients range from large companies such as DHL and Orange to small companies and startups. He also is technical director or advisor to a number of startup companies. Hubert lives in Oxford and in his abundant spare time he likes to pretend that he coaches rowing, dances salsa, dabbles with martial arts and drives too fast.