c++ - 为什么编译需要这么长时间?
Precompiled headers are way faster, as has been known at least since 1988. The usual reason for a C compiler or C++ compiler to take a long time is that it has to #include, preprocess, and t

Precompiled headers are way faster, as has been known at least since 1988.
The usual reason for a C compiler or C++ compiler to take a long time is that it has to #include, preprocess, and then lex gazillions of tokens.
As an exercise you might find out how long it takes just to run cpp over a typical collection of header files---then measure how long it takes to lex the output.
gcc -O uses a very effective but somewhat slow optimization technique developed by Chris Fraser and Jack Davidson. Most other optimizers can be slow because they involve repeated iteration over fairly large data structures.