Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Templates, Inlining, and Code Size

Status Draft outlineSection High-Performance C++

Templates can remove abstraction overhead and enable specialization, but more instantiations and aggressive inlining can increase compile time, binary size, and instruction-cache pressure.

Planned model

Compare virtual dispatch, function objects, templates, and explicit branches. Inspect the optimized assembly and measure both steady-state work and code size.

Questions

  • Did the abstraction disappear in the generated code?
  • Did specialization duplicate a hot path or create instruction-cache pressure?
  • Is link-time optimization changing the conclusion?

Exercise

Implement one packet handler with runtime and compile-time dispatch, then make a claim supported by assembly and benchmark evidence.