jhtrace/buildwhy
About
Find out why the clean build of your CMake project is slow and what to fix first. Make or Ninja, GCC or clang, no build changes.
Developer ToolsWhat you can do
- Clean build, measured: buildwhy measure builds the project from scratch in a separate directory and reports wall time, CPU time, how busy the cores were and the critical path.
- The include lines to fix: ranks #include lines by how much code they pull in and how much sooner the build would end without them, and who added each one.
- Code compiled for nothing: finds templates and inline functions that many files compile, only for the linker to keep one copy.
- Savings in seconds: estimates come from replaying your real build log with the change applied, using the same number of jobs and the order make or Ninja would use.
Measured star growth
- in 24h
- Collecting history
- in 7 days
- Collecting history
- in 15 days
- Collecting history
- in 1 month
- Collecting history
Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.
README.md
Original
buildwhy shows why the first build of a CMake project takes as long as it does, and which change would make it end soonest. It works on the project as it is: no changes to CMakeLists.txt, presets or build settings.
Key capabilities
- Clean build, measured:
buildwhy measurebuilds the project from scratch in a separate directory and reports wall time, CPU time, how busy the cores were and the critical path. - The include lines to fix: ranks
#includelines by how much code they pull in and how much sooner the build would end without them, and who added each one. - Code compiled for nothing: finds templates and inline functions that many files compile, only for the linker to keep one copy.
- Savings in seconds: estimates come from replaying your real build log with the change applied, using the same number of jobs and the order make or Ninja would use.
- One HTML page: a 3D dependency graph, a build timeline and all reports in a single offline file you can keep as a CI artifact.
On fmt's test suite, a 27 s build on 4 cores, it found that 41% of the object code was thrown away by the linker. See the full example.
Quick start
curl -LO https://github.com/jhtrace/buildwhy/releases/latest/download/buildwhy-x86_64-unknown-linux-musl.tar.gz
tar xzf buildwhy-x86_64-unknown-linux-musl.tar.gz
mkdir -p ~/.local/bin && install -m 755 buildwhy-x86_64-unknown-linux-musl/buildwhy ~/.local/bin/
cd your-project
buildwhy measure --preset dev --includes --duplicates --html
Use your own preset name, or leave out --preset for CMake's defaults.
Other platforms and checksums: Installing.
Runs on Linux and macOS (tested in CI) and Windows (binary, untested), with CMake + Ninja or Make and GCC or clang.
Documentation
- Installing and supported platforms
- Usage: all commands, full builds, the HTML page, presets, CI
- Which includes cost the most
- Code the linker throws away
- Make builds
- Example: fmt, with real output and pictures
- How it works and limitations
License
MIT
Explore related projects
Loading…