Link Time Code Generation

  • Thread starter Thread starter Ed
  • Start date Start date
E

Ed

Hello, dear all,
In the VS2005, Project Release Configuration, the default option of
"General | Whole Program Optimization" is "Use Link Time Code
Generation".

I find when use this option, the size of the objects and output is
vary large. The object use this option, which size is 10 times of the
one w/o it.

Is this normal?
 
In the VS2005, Project Release Configuration, the default option of
"General | Whole Program Optimization" is "Use Link Time Code
Generation".
I find when use this option, the size of the objects and output is
vary large. The object use this option, which size is 10 times of the
one w/o it.

I've found that with LTCG on, the intermediate .obj files are
larger, but the output .exe is usually about 25% smaller. This is
because some of the work is saved until the link phase, so more
intermediate information needs to be kept. LTCG costs disk space and
time, but I've found that it's worth it.

Nathan Mates
 
I've found that with LTCG on, the intermediate .obj files are
larger, but the output .exe is usually about 25% smaller. This is
because some of the work is saved until the link phase, so more
intermediate information needs to be kept. LTCG costs disk space and
time, but I've found that it's worth it.

Nathan Mates

--
<*> Nathan Mates - personal webpagehttp://www.visi.com/~nathan/
# Programmer at Pandemic Studios --http://www.pandemicstudios.com/
# NOT speaking for Pandemic Studios. "Care not what the neighbors
# think. What are the facts, and to how many decimal places?" -R.A. Heinlein

In my test, the output is the static library, so, the linker will not
do any work to it. So my static library is very fat.
Your 25 percent smaller is compared to what?
 
In my test, the output is the static library, so, the linker will
not do any work to it. So my static library is very fat. Your 25
percent smaller is compared to what?

The linker will do the work when it makes the final exe. My 25%
smaller is a comparison based on LTCG being on/off. I added a project
configuration-- 'Release' vs 'ReleaseLTCG'. The final exe is about 25%
smaller when LTCG is on.

Nathan Mates
 
The linker will do the work when it makes the final exe. My 25%
smaller is a comparison based on LTCG being on/off. I added a project
configuration-- 'Release' vs 'ReleaseLTCG'. The final exe is about 25%
smaller when LTCG is on.

Nathan Mates
--
<*> Nathan Mates - personal webpagehttp://www.visi.com/~nathan/
# Programmer at Pandemic Studios --http://www.pandemicstudios.com/
# NOT speaking for Pandemic Studios. "Care not what the neighbors
# think. What are the facts, and to how many decimal places?" -R.A. Heinlein

Thank you!
You also mentioned it's worth to turn it on. Have you do the
comparison to the efficiency before?
 
NM- [Wed, 04 Jul 2007 04:51:00 -0000]:
configuration-- 'Release' vs 'ReleaseLTCG'. The final exe is about 25%
smaller when LTCG is on.

Have you used, Enable function-level linking
(Code generation)? That throws out unused
routines/segments. I can't imagine you getting
25% any other way. FLL is probably implicit
with LTCG.
 
Back
Top