C++ compiler guns for speed records

Developers dread the delays for a C++ project to build, but Zapcc, a variation on the Clang/LLVM compiler, cuts wait times by half or more

C++ remains the go-to language for the highest-end, hardest-core, and most pedal-to-the-metal applications. But compiling a large C++ project means dealing with agonizing wait times.

Israeli software outfit Ceemple Software Ltd. recently concluded a round of beta testing for what it hopes to be a major fix for that problem: Zapcc, a compiler that can cut compilation times for many C++ projects by half or more.

Zapcc uses the Clang compiler, part of the LLVM compiler framework, and outfits it with a cache that preserves information about each compilation run so that it can be reused in subsequent passes. The cache runs as a server on the same system, but the amount of memory it uses can be adjusted by the developer if it becomes a problem.

Zapcc works by caching header files (with an .h extension), since the size and complexity of those tend to be the biggest reason why C++ projects have long compilation times. Header files also rarely change, so caching them provides one of the most efficient ways to speed up the compilation process. Regular .c and .cpp files aren't cached, but it's possible to add them to the cache if the need arises. (Compiling regular C apps, as opposed to C++, doesn't yield any speedup, though.)

Benchmarks released by Ceemple Softare claim speedups of anywhere from two to five times for most projects. With some larger projects, where the changes are confined to one file, the speedups can approach a factor of 50.

Baptiste Wicht, a developer in Fribourg, Switzerland, claims to have participated in the Zapcc beta program and wrote about his experiences with Zapcc versus generic Clang and GCC. On the whole, he observed Zapcc to be about three times faster than Clang and twice as fast at GCC when compiling debug builds. With release builds, the speedup went down to about 1.2 to 1.4 times faster than Clang and 1.1 to 1.3 times faster than GCC. Overall he was impressed, especially since Zapcc can replace Clang as-is.

Zapcc isn't available for release yet, but the proposed licensing may give some people pause: It'll be released under a commercial license only, with no word of an open source version. Clang itself is open source, albeit released under the BSD license, so this kind of commercial repurposing of the project is permitted.

Other software vendors are also working on speeding up their C++ tools. Microsoft unveiled plans earlier this year for a set of sophisticated optimizations to its Visual C++ compiler, although most of Microsoft's improvements there revolve around the performance and footprint of binaries generated by the compiler, rather than compilation speed itself.