Institute for Advanced Professional Studies

High-Performance C++ Programming




Course Overview:

This hands-on course covers how to write object-oriented C++ software that is efficient in time and/or space. It provides a process for making existing software more efficient by profiling and then making well-understood transformations to the source code. It focuses on the performance aspects of key language features and provides a variety of language-specific, object-oriented, and general techniques for improving program efficiency. Importantly, it focuses on how to ensure that high-performance programs are both reliable and maintainable.

The course is case study oriented, taking programs, measuring their performance, making transformations, and then iterating the process until the code meets performance goals. In addition, the course is empirically oriented: students are given programs whose performance they observe and then try to improve based on the principles taught in the course.


Course Objectives:

Upon successful completion of this course, participants will be able to:

  • Use profiling tools to identify bottlenecks in existing programs.
  • Describe a variety of specific techniques for improving C++ program efficiency.
  • Successfully improve the performance of non-trivial applications.
  • Recognize why some commonly used coding techniques lead to inefficient programs.

Topic Outline:

  • C++ Program Performance and Efficiency
    • What efficiency is all about
    • Designing to support performance improvements
    • Ways to measure performance and find bottlenecks

  • Inlining
    • What inlining does
    • When to inline
    • When not to inline
    • Different approaches to inlining
    • Effect of profile-based inlining on speed and size

  • The Object Lifecycle
    • When objects are created and copied
    • Minimizing object creation and copying
    • Efficiently using arrays
    • Minimizing conversions
    • Minimizing work when creating and destroying objects
    • Copy-on-write and reference counting

  • Templates
    • How templates can lead to code bloat
    • Using pointers to minimize template instantiation
    • Using inheritance to avoid code replication
    • Issues with template functions
    • Optimizing by specializing template functions
    • Optimizing fixed-size collections with templates

  • Inheritance
    • Issues with dynamic binding
    • Removing unneeded dynamic binding
    • Collapsing families of virtual functions
    • Replacing inheritance with layering and templates
    • When virtual destructors can be avoided

  • Memory Management
    • When and how to override the default memory manager
    • Problems with general-purpose storage allocators
    • Providing class-specific storage allocation
    • Managing a class-specific free storage pool

  • General Tips and Techniques
    • Using classes to solve efficiency problems
    • Parameterizing classes with implementations
    • Collapsing system layers
    • Optimizing class operations
    • Moving run-time tests to compile time
    • Trading space for time
    • Useful C-specific optimizations


Course Duration:

2 days


Intended Audience:

Experienced C++ programmers who wish to become proficient at writing high-performance C++ programs, such as embedded applications, while maximizing modularity and maintainability.


Technical Prerequisites:

Participants should be experienced C++ programmers. They must be comfortable with all the major features of the language, including pointers, dynamic storage allocation, classes, abstract types, templates, and inheritance. They should know how to use standard facilities to edit, compile, and debug applications.


Course Format:

Hands-on lecture/workshop




© Copyright 1997-2015 Institute for Advanced Professional Studies