Code Size Compiler Optimizations and Techniques for Embedded Systems
summary
Describes concrete compiler flags and passes that actually cut binary size: use -Os or the more aggressive -Oz, disable exceptions/RTTI and loop unrolling, reduce inlining thresholds, or try fno-function-sections and fno-jump-tables; enable link-time optimizations (full LTO or thin LTO) and identical-code-folding/merge-function to dedupe. Reports example footprints (std::map ~14 KB vs unordered_map ~15 KB; vector ~14.3 KB vs list ~13 KB) and a tiny instrumentation prototype that costs ~5 bytes per function to find dead code.
AI-written summary · about
chapters (12)
- 0:00Introduction
- 1:12Classification
- 2:01Compiler Optimization
- 7:41GCC Compiler Optimizations
- 21:08C Optimizations
- 23:04Source Code Optimizations
- 24:29Cheaper Data Structures
- 26:00Map vs List vs Vector
- 27:43Code Source Code
- 31:14Shared Libraries
- 32:06Binary Compression
- 33:02References
related talks
45mA Few Effective gcc/clang Optimizations for Embedded Systems
54mGCC/Clang Optimizations for Embedded Linux
24m(Ab)using Compiler Tools
28mCode optimization tips and tricks
15mNot So Fast: Understanding and Mitigating Negative Impacts of Compiler Optimizations on Code Reuse G
19mCode Size Reduction Deep Dive: Zc Extensions and Dictionary Compression Custom Instruction
52mUnderstanding Compiler Optimization
19mExploiting Undefined Behavior in C/C++ Programs for Optimization: A Study on the(…)
