liveBook · Manning

Chapter 16: Performance

What you will learn in chapter 16 of Modern C, Third Edition

The chapter introduction argues for safe, relevant performance work and explains how programmers can give C compilers useful optimization information.

After this chapter you will be able to

What it builds on

Section by section

Introduction

The chapter introduction argues for safe, relevant performance work and explains how programmers can give C compilers useful optimization information.

Key terms: premature optimization, safety, performance, block-scope variables, calloc, static 1, static N, VLA notation, aliasing, inline

16.1 Inline functions

The section explains how inline function definitions can make functions available for compiler optimization across translation units, and the tradeoffs of using them.

Key terms: inlining, call overhead, caller, callee, definition, declaration, translation unit, static, inline, function symbol

16.2 Using restrict qualifiers

Explains how restrict-qualified pointers let compilers assume exclusive access, and how that promise affects callers and library functions.

Key terms: restrict, exclusive access, alias, memcpy, memmove, overlap, character types, aliasing, string-processing functions, format parameter

16.3 Unsequenced and reproducible attributes

This section explains the guarantees required by [[unsequenced]] and [[reproducible]], and how those guarantees permit optimization.

Key terms: [[unsequenced]], pure function, global variables, system state, floating-point rounding mode, errno, sqrt, FP_CONTRACT, FENV_ROUND, scope

16.4 Measurement and inspection

This section shows how to assess C code performance through measurement, statistical checks, and inspection of measurement overhead.

Key terms: complexity assessment, performance assessment, measurement, instrumentation, bias, timespec_get, iterations, mean, relative standard deviation, skew

16.5 Summary

Where this is used later

Concepts explained in this chapter

← Chapter 15: Program failure Chapter 17: Function-like macros →

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.