Analyze, Visualize and Migrate Between Build-systems

Is your C++ build slow or unintelligible? We are currently looking for more case studies. If you are interested in improving your Linux-based build (commercial or open-source), please get in touch!

https://buildinfer.loopperfect.com/

The C++ community is fragmented due to the variety of build-systems used. This fragmentation makes it difficult to:

For the C++ community this means:

Wouldn’t it be great if we could extract a readable build description of any C++ project, regardless of the build-system used?

Announcing BuildInfer

By recording the build process at a system-level, we can infer high-level information about the project structure. Since BuildInfer records at this low-level, our technique works for any C++ build system.

Once we have a high-level build description, we can visualize, transform and even port complex build-systems to more powerful ones, such as Buck and Bazel.

Initial Findings

We have already had success porting the following projects to Buck:

Furthermore, we discovered that none of these projects ship with a reproducible build-system! By porting them to Buck, we can guarantee this.

Reproducible builds are crucial for security, cache performance and debugging. For more information, see:

Mapnik

Mapnik is an open source mapping toolkit for desktop- and server-based map rendering, written in C++.

View the full SVG image on GitHub

The graph tells us the following:

LLVM & Clang

The LLVM compiler infrastructure project is a “collection of modular and reusable compiler and toolchain technologies” used to develop compiler front ends and back ends.

We also performed a simple analysis of the build-times in the context of the dependency graph. These tables show the estimated cost of changing various files in LLVM by summing the time taken to build each file plus all of its dependees.

These files are “hot-spots” for incremental builds, and might be good candidates for refactoring.

Please note that these numbers are assuming a single-threaded build; a real build would take some scale-factor of these times.

The header llvm-config.h is particularly interesting. It defines some constants referenced throughout the project:

So every time the version string or default target is changed, LLVM incurrs a (scale-factor of) 15,264 second build! These values could potentially be refactored into a translation-unit:

We also generated a graph showing the interaction of individual file groups and executables:

View the full SVG image on GitHub

The graph show us that:

OpenCV

OpenCV is a library of programming functions mainly aimed at real-time computer vision.

We also generated a graph showing the interaction of individual file groups and executables:

View the full SVG image on GitHub

Intrigued?

Is your C++ build slow or unintelligible? We are currently looking for more case studies. If you are interested in improving your Linux-based build (commercial or open-source), please get in touch!

You may also be interested in…

7 Reasons to Use Buck Build_Buck is a cross-platform, cross-language build system made for large scale compilation at Facebook. All Buckaroo…_hackernoon.com