Operating System - Tru64 Unix
1829582 Members
1069 Online
109992 Solutions
New Discussion

Re: cc -spike option

 
dom kris
Frequent Advisor

cc -spike option

Hi,

this is just a concept question. Is there any difference beween the '-spike' option and the '-O2' option when compiling C code using 'cc'.
If I understand it correctly, spike will optimize better then 'O' but O is a more generic type of optimization and thus if you have to deploy your program on a wide variaty of Tru64 systems (different os version, harware),you are better of using -O then spike

With kind regards

Kris
2 REPLIES 2
Hein van den Heuvel
Honored Contributor

Re: cc -spike option


It is indeed a concept question.

The -o familiy of optimization levels and -spike independend/complementary.

And they are different still from the -arch and -tune directives which bring in the cpu/system dependencies you hint to.

The -o switch is your basic optimization.

Always recommended, only catch is that it tends to bring out programming errors/sloppiness more clearly and may be a little harder to debug.

The -spike is part of an 'approach' involving feedback. You had to compile first, make a sample run collecting feedback, re-compile with that feedback to allow the compiler to know for example which branches are more likely to be taken.

Also recommended as it can gain 3% - 20% of CPU time. It's catch is that you need more development work to get that feedback applied. Also, some folks worry themself to death whether they collected feedback from agood run or not. Don't worry too much about that. Any feedback will likely achieve 80% of the potential gain of this option.
So while it is extra nice to collect feedback over a true production run, Don't let that stop you if that is hard to get and just use for example a regression test as feedback generator.

hth,
Hein.
dom kris
Frequent Advisor

Re: cc -spike option

Thanks for the info!

Kd