I have automatic generated code (around 18,000 lines, basically a wrap of data) and other about 2,000 lines code in a C++ project. The project turned on the link-time-optimization operation. /O2 and fast-code optimization. To compile the code, VC++ 2008 express takes incredibly long time (around 1.5 hours). After all, it has only 18,000 lines, why the compiler takes so much time?
a little explanation to the 18,000 code. It is plain C, not even C++ which includes many unpacked for-loop, a sample would be:
a[0].a1 = 0.1284; a[0].a2 = 0.32186; a[0].a3 = 0.48305; a[1].a1 = 0.543; ..................
It basically fill a complex struct. But not so complex to compiler I guess.
The Debug mode is fast, only the Relase mode has this issue. Before I have the 18,000 lines of code, they are all fine. (that time the data is in external location). However, the release mode does many work which reduce the size of exe from 1,800kb to 700kb.
this issue does happen in link stage because all .obj files are generated. I have suspect on link-time-code-generation too but cannot figure out where is wrong.