3 ms·
C++ compile times are a huge problem for large projects (and painful even on medium projects). The Go designers joke that Go was conceived while waiting for a C
by dottrap 11y ago
C++ compile times are a huge problem for large projects (and painful even on medium projects). The Go designers joke that Go was conceived while waiting for a C++ compile. (Google engineers I know tell me their full C++ compile times can be measured in hours.) AAA game devs I've met tell me their C++ project times are usually 30 min to an hour.
On even the medium size projects I work on, the compile time difference between C and C++ can be magnitudes.
C++ encourages templates, which are typically included by everything, which in turn causes lots of files to need to be recompiled.
Both C/C++ have fragile ABIs so if you have built libraries and you change their memory layout, you need to recompile world. And in some cases, even if your library is internal and not external to your project, a bad build system or a bug can fail to detect this kind of change leading to subtle bugs/crashes, which then in turn encourages developers to do full rebuilds periodically.
It is hard to find real world data converting C++ to C to measure compile times because nobody wants to invest in rewrites like this. However, I am also among those people that have shifted back to pure C from C++ and seen compile times improve by magnitudes. I sometimes work on slow devices, like the Raspberry Pi, and this really magnifies the difference. (On this, the C parts can take 10-20 minutes, and the C++ parts are measured in many hours.)
This one person recently wrote about he switched back to C from C++. He mentions his build times went from about 10 minutes to 4 seconds.
http://chrismdp.com/2015/04/how-i-doubled-the-speed-of-my-game-by-giving-up-on-c-plus-plus/ http://chrismdp.com/2015/04/how-i-doubled-the-speed-of-my-ga...