针对Xerces-C++项目的基准测试表明,build2构建系统在禁用部分功能后的完整编译速度达到3.355秒,相比Ninja的3.4秒快2.2%[1]。该项目包含299个C++翻译单元,GCC编译器进行了10次检查调用[1]。
build2初始配置下的构建时间为3.8秒,但通过禁用change tracking和文件缓存压缩功能后速度明显提升[1]。作者指出build2能够匹配或超越Ninja性能的关键在于三项设计决策:积极的信息缓存机制、多线程处理能力以及不同的C/C++编译模型[1]。此外,CMake生成Ninja构建文件本身耗时15.6秒[1]。
A performance comparison of the build2 construction system against the widely-used Ninja build tool has revealed that build2 can match or exceed Ninja's speed when certain features are optimized.[1] Testing on the Xerces-C++ project, which comprises 299 C++ translation units, demonstrated that build2 with change tracking and file cache compression disabled achieved a build time of 3.355 seconds, surpassing Ninja's 3.4 seconds by 2.2%.[1] In contrast, build2's initial full build required 3.8 seconds, while Ninja completed its benchmark run in 3.4 seconds.[1]
The performance advantage stems from three core design decisions in build2's architecture: aggressive information caching, multithreading capabilities, and a distinct C/C++ compilation model.[1] The analysis also noted that generating Ninja build files through CMake consumed 15.6 seconds, adding significant overhead to the overall build process.[1] During testing, the GCC compiler received a total of 10 invocation checks, divided equally between C and C++ compilations.[1]