4 ms·
> Don't get me wrong: the price of minimizing compilation times is eternal vigilance. I don't follow any such rules for my own codebase and here are how my com
by jcelerier 4y ago
> Don't get me wrong: the price of minimizing compilation times is eternal vigilance.
I don't follow any such rules for my own codebase and here are how my compilation times look like for three representative files: https://streamable.com/pboot1 https://streamable.com/pboot1
- first and second one have tons of Qt / std / boost:: / etc... stuff
- third one includes opencv.hpp (which includes most opencv libraries)
I have a hard time seeing the benefit of putting more effort in this considering that the edit -> build -> run cycles takes around a second or two in all cases, and I don't even use all the clang PCH options available in recent clang versions.
So no,
> the price of minimizing compilation times is
using your damn tools correctly.
- ncmncm 4y agoThis. For decades, Bloomberg development, and people so unfortunate as to follow them (because of silly book from the early '90s) adhered to an idiotic convention that wrapped every #include directive in an #ifdef block. Of course, all compilers, also for decades, recognized when they had already seen an include file that itself was wrapped in its own #ifdef block, and skipped it. Later this same behavior was simplified to #pragma once, obviating the need to invent unique preprocessor names for all headers, which on occasion collided or were misspelled, with amusing results. There are no remaining C++ compilers in use, outside of sad pre-Standard backwaters, that do not implement #pragma once. And anyway, the proper solution if you are worried about compilation time is to switch to C++20 modules.