Interview With Patrice Roy (Optimizing with Modern C++) - CppCon 2024

Channel

Register Now for CppCon 2024: https://cppcon.org/registration/
Join Patrice Roy and Kevin Carpenter from September 15th - 20th at CppCon 2024 Aurora, Colorado, to enjoy the many and varied inspirational talks!
---

Interview With Patrice Roy (Optimizing with Modern C++) - CppCon 2024

Kevin Carpenter from @cppevents interviews Patrice Roy ahead of his two-day onsite training course "Optimizing with Modern C++"

Course Description
C++ is seen by many as a language one uses to get more from a program: more speed, more deterministic behavior, lower resource consumption, etc. Interestingly, C++ does not necessarily make programs faster or smaller; what C++ brings to programmers is control, and that control can lead to all sorts of optimizations.

This course will bring participants to:

Identify those locations in a program that could benefit from optimizations, including gathering information from profiling tools
Perform fecund optimizations of a function or of the entire program: reducing memory consumption, increase average execution speed, reducing latency on some key operations, increasing compilation speed, etc. This will include a look at programming practices that make code better even though they are not optimizations per se
Benefit from compiler flags to add to the optimizations resulting from our efforts on the source code itself
Topics covered in this course include:

Fundamentals (approx. 60 minutes)
What do we mean by “optimization”?
Optimizing for what / towards what end?
Average execution speed
Worst-case execution speed
Smallest average deviation
Reducing latency when some event occurs
Memory consumption
Layout of objects in memory
Understanding the interdependencies between these aspects
Impact of optimizing one aspect on the others
Measuring (before and after)
Detecting regressions
How we will measure execution speed
How we will estimate memory consumption for one or many objects
This is a delicate topic
Exercises
Note: this first section will be limited to a broad overview of the topics covered therein.

Profiling and identification of “hot spots”
This section will emphasize identifying those locations in a program where optimization could bring benefits. We will use two approaches:
Analytical approach, reading code
Identifying locations where the need for optimization is evident
Examining examples where the need for specific gestures is a lot less evident
Examining examples where optimizations would lead to local or systemic performance regressions
Profiling using tools
The goal here is to make it clear that investing a lot of effort at the wrong place in a program can be an inefficient use of our time
Exercises (integrated throughout the section)
Note: the topics in this section will be reinvested and integrated throughout the rest of this training.

Leveraging modern C++: techniques and language features
Impact of standard algorithms and lambda expressions
These have been called “negative cost abstractions” in the sense that, if well used, they make programs that use them faster than programs that do not
Impact of object size and layout on program size and execution speed. In particular, we will discuss:
Alignment
The empty base optimization and the [[no_unique_address]] attribute
The impact of AoS (array of structs) and SoA (struct of arrays) representations
True sharing and false sharing
Bit fields
Classical object-oriented techniques and modern alternatives
Generic approaches (templates, traits, concepts)
Static polymorphism
Using std::variant
Leveraging the type system to move computation from run-time to compile-time
Compile-time evaluation
If constexpr
constexpr
consteval
constinit
Argument passing and return value-related topics
Move semantics
Return value optimization (named or not)
Perfect forwarding
Memory management
Smart pointers (and using them wisely)
Overloading operators new and delete
Allocators (pre-C++ 11, since C++ 11, PMR)

Course Instructor - Patrice Roy

Patrice Roy has been playing with C++ either professionally, for pleasure or (most of the time) both for over 30 years. After a few years doing R&D and working on military flight simulators, he has moved on to academics and has been teaching computer science since 1998. Since 2005, he has been involved more specifically in helping graduate students and professionals from the fields of real-time systems and game programming develop the skills they need to face today’s challenges. He has five kids, and his wife ensures their house is home to a continuously changing numbers of cats, dogs and other animals.

Registration for CppCon: https://cppcon.org/registration/
100+ Sessions Over 5 Days! Pre and Post Con Workshops/Classes/Course and Much More!
Join Us Onsite!

#cppcon #cppprogramming #cpp #programmingcourse #cpp #computer #coding #cpplearning #code #software #softwaredevelopment #technicalcourses #cplusplusprogramming #cplusplus