-
Optimization settings
We are using Paradigm C compiler to build embedded C application under small memory model and for 186 processor. Paradigm offers set of optmizations bits. like optimization by speed, by size, loop optimization, jump optimization etc.
In such scenario, what is advatage with boosting the optimization and what is disadvantage?
Please let me know,
Thanks,
-
Advantage: compiling for size may mean the code fits in the memory allowed
Disadvantage: it now runs too slow to meet its performance requirements.
There are no free lunches, and no easy way to decide which is best for you. You need to try each one and evaluate the impact in your particular case.
Another disadvantage (perhaps) is that aggressive optimisation often flushes out bugs which would otherwise remain hidden.
-
I was under impression that compilers which do maximum optimization are the good compilers.
But if this is the case, how do we classify a good compiler?
Thanx
-
Maximum optimization by a compiler means it has to depend on compiling perfect code source code. Otherwise it's assumptions could cause problems. It has nothing to do with good/bad compilers.
Generally, optimization makes the machine code larger. You don't have memory. You need to depend on good algorithms instead of the compiler.
-
> compilers which do maximum optimization are the good compilers.
"maximum" and "good" are both subjective and relative.
Take any specific block of code and pass it through a number of different compilers with a variety of optimisation settings, and you'll get a whole bunch of different answers. How do you decide which has "maximum" optimisation?
For a start, are you trying to maximise speed or minimise space?
> how do we classify a good compiler?
One which translates valid C programs correctly.
In particular, "aggressive optimisation often flushes out bugs" is still more likely to be your problem than a problem with the compiler. That's not to say that compilers don't have bugs (they do), but if a compiler does have a bug, it's more likely to be in some small corner of some particular optimisation option than in the core translation.