Parallelize libstdc++ build by structuring source directories independently.
Libstdc++'s build time reduced by parallelizing compilation of its independent source directories.
This commit significantly speeds up the build process for libstdc++ by enabling parallel compilation of its source directories. Previously, automake’s default SUBDIRS implementation processed directories sequentially, limiting parallelism. By defining explicit targets for each independent directory and managing dependencies, particularly for src/experimental, make can now build these directories concurrently. This change leads to substantial reductions in build times, with a 62% decrease observed for libstdc++‘s source directory build on aarch64.
In Details
Addresses a build performance bottleneck in libstdc++-v3/src by restructuring its Makefile.am to allow parallel compilation of its subdirectories. It introduces all-parallel-subdirs and all-in-% targets, while maintaining the sequential nature of src/experimental's convenience archive linking. This change leverages make -j more effectively, as the sequential SUBDIRS loop was a major constraint. The build time improvements are significant, particularly during bootstrap phases.
- libstdc++
- The GNU Standard C++ Library, which provides the C++ standard library implementation for the GCC compiler.
- Makefile.am
- A file used by Automake to generate Makefiles. It specifies build rules and dependencies in a portable way.
- Automake
- A tool that automatically generates
Makefiles fromMakefile.intemplates, simplifying the build process for cross-platform software. - SUBDIRS
- A variable in Automake/Makefiles that specifies a list of subdirectories to be processed recursively, typically in a sequential manner by default.
- Convenience archives
- Static libraries (
.afiles) created by a build system that serve as intermediate targets, simplifying dependencies and linking for other parts of the project.