(clang-)Tidying up includes in systemd
2026-01-31T18:20:00+01:00 for 00:20
This year, systemd had a breakup with its bad practice of including unused headers all over the codebase. This resulted in:
- A 33% speedup in from scratch build times
- A 50% reduction in runtime for our build test CI jobs
- Thousands of lines of code removed from the codebase
I'll present how I went about this work, using clang-include-cleaner, clang-tidy and ClangBuildAnalyzer, and including the challenges I faced:
- A scalable way to organize source to minimize unused headers
- Macros
- Different build configurations which change the used headers in a source file due to #ifdef conditionals
- Missing features in clang-tidy and clang-include-cleaner (and my contributions to LLVM to implement those)
https://github.com/systemd/systemd
https://github.com/llvm/llvm-project
github.com/aras-p/ClangBuildAnalyzer
View on FOSDEM site