~/talk

How to Keep C++ Binaries Small - Techniques for C++ Optimization

Talkat C++ on Sea 2024 · 2024-07-02..07-05· [software-architecture]
slides:none on file

Shows concrete levers and measured wins: a global array initialized to ones produces ~100 KB while changing to zero collapses it to ~16 KB (99K → 16K by zero-init); switching a class to polymorphic pays a big fixed cost—adding the first virtual inflates the binary by roughly 150 KB (first virtual adds ~150KB). Uses inspect tools like size, objdump, nm, mcboy and flags like -Os/-Oz, -flto, -fdata-sections -ffunction-sections + --gc-sections, -fno-rtti/-fno-exceptions and shows they often beat micro-refactors. Measure everything in CI.

AI-written summary · about

  1. 0:00Introduction
  2. 23:33Coding practices for size
  3. 1:00:14Special member functions
  4. 1:50:58Compiler and linker settings
  5. 2:07:59Removing RTTI and exceptions
  6. 2:21:02Summary
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.