Warp, a Fast C and C++ Preprocessor
Andrei Alexandrescu interviews Walter Bright:
Conventional wisdom has it that preprocessing time is a negligible part of building a C++ binary. C++ is notoriously difficult to parse, which means that C++ parsers tend to be large and slow compared to their counterparts for other languages. Code generation is also quite the time sink, especially if you’re using optimizations. Finally, linking is a large serial step at the end of each build, and using the gold linker only helps so much. Therefore, it would seem that the lowly task of going through the included files and expanding macros would take a comparatively short time and be essentially impossible to improve upon.
Not so! Replacing gcc’s preprocessor with warp has led to significant improvements of our end-to-end build times (including linking). Depending on a variety of circumstances, we measured debug build speed improvements ranging from 10% all the way to 40%, all in complex projects with massive codebases and many dependencies. That’s not per-file speed, but rather global times measured for scenarios like “build after changing a header file.”
There sure are a lot of A-players at Facebook.
1 Comment RSS · Twitter
I spent many (probably too many) hours last year watching C++ and D talks, mostly from Microsoft's GoingNative (https://channel9.msdn.com/Events/GoingNative/2013) and DConf (http://dconf.org/2013/).
As someone who's spent much of his programming life avoiding C++ wherever possible, it was enlightening.