C++ · Advanced level

Advanced level · Module 6: C++ Capstone Project · Lesson 4 of 5

Parallelism and Performance

Add parallel processing and optimise the tool, proving correctness and speed with tests and measurements.

In this lesson you will

  • Add a correct parallel mode
  • Optimise against measurements and document the results

Key concepts

parallel moderesult equivalencebenchmark reportperformance budget

The lesson

Add parallel processing with a task-based design: split the input by file or by day, process each part independently and merge the results.

Prove correctness by comparing parallel and sequential results on several data sets, and run under ThreadSanitizer.

Profile, optimise the hot spots and write a benchmark report against your performance requirement: data size, machine, thread counts, median times.

Step by step

  1. Implement the parallel mode.
  2. Add a test comparing sequential and parallel output.
  3. Profile and optimise one hot spot.
  4. Write the benchmark report.

Practice activity

Complete milestone 4: parallel mode, equivalence tests and benchmark report.

Expected result: Identical results in both modes, a clean ThreadSanitizer run and a report showing whether the performance requirement is met.

Check your understanding

  1. How do you show the parallel mode is correct?

    Show answer

    By comparing its results with the sequential mode on several data sets and running ThreadSanitizer.

  2. What must a benchmark report include?

    Show answer

    Data size, machine, thread counts and repeatable timings.

Taught live by an instructor — online or in person. Free course lessons are for self-study and do not lead to a certificate — see registration options.