3 ms·
There are a few factors: * Massive includes. Every compilation unit ends up including many header files. Most of these header files include more header files
by advisedwang 14y ago
There are a few factors:
* Massive includes. Every compilation unit ends up including many header files. Most of these header files include more header files, often ones already included. If a header file has previously been included, it must be included a second time as C++ allows the meaning of including a file to differ each inclusion. This results in a vast amount of necessary preprocessing.
* Compiling the same code multiple times. Every compilation unit must generate code for every template it uses, even if other compilation units are generating the same code. Only at link time are the multiple instantiations of the same code collapsed. As the STL is a massive blob of templates this is a frequent issue!