Amalgamation
summary
Amalgamation merges many C sources into single translation units using CMake’s compile unity mode to expose the compiler (not the linker) for cross-file inlining. Tests show sqlite3-style claims (around 15% in one report) but Zephyr gains vary: microbenchmarks see ~5% context-swap lift on QEMU, GPIO toggles fall from ~250 ns to ~50 ns with LTO and drop to two instructions when specific drivers are merged. Tradeoffs: static-name collisions, slightly larger footprint unless paired with LTO, and new timing-sensitive bugs.
AI-written summary · about
chapters (14)
- 0:00Introduction to amalgamation
- 1:24What is amalgamation
- 3:51Unity mode demo results
- 5:34Testing on Zephyr thread benchmark
- 6:59Fixing old GPIO API bug
- 9:34Q&A on name collisions
- 10:59Q&A on code changes
- 11:20Q&A on networking stack
- 12:45Q&A on footprint impact
- 13:49Q&A on risks and behavior
- 15:13Q&A on PR scope
- 16:58Q&A on usage flexibility
- 18:01Q&A on static variable collisions
- 19:05Q&A on compile time impact
