??? 07/02/07 13:26 Read: times |
#141411 - just like medicine Responding to: ???'s previous message |
Erik Malund said:
TURN OFF THE STUPID OPTIMIZER optimisers are not stupid! Optimisers are very cunning, and very clever indeed! In tha context, I mist agree; However just like medicine optimizers are "poison with desirable side effects". My statement was related to using the optimizer without accepting what an optimizer does is stupid. And that's the trouble - you also need to be very smart to work out what the optimiser has done, and then still be able to follow your code. You're always asking for trouble if you use a tool that you don't understand... Understanding the function of an optimizer is a bit of a job, but, by no means hard and the 'problem' with using an optimizer arise from several sides 1) the result will not be 'as you coded it' and, that may and may not be OK for your app, just do not expect it to be so. 2) it is virtually impossible to know if a breakpoint happens ONLY for what you want it to break on and the time it takes to figure out if, indeed, it was, is one penalty arising from optimizing. 3) there has been many cases posted "the code runs non-optimized, but not optimized" and in such cases you are screwed because you "can not" debug the optimized code. Of course, if you remembered to polish your halo and made perfect code, that is not a problem. basically IMHO optimized code is not maintainable. Erik PS my aversion to optimizers is, to a large degree, that much is stuffed in the optimizer that really should be handled by an optimal compiler. an example mov a,@dptr mov r7,a ; R7 never used below mov a, r7 jnz ... is reduced to mov a,@dptr jnz ... by the optimizer WHY DOES THE COMPILER NOT DO THAT? is it to make the optimizer more impressive? If the compiler was made 'optimal' half the advantages of using an optimizer would disappear and a much more optimal fully debuggable code would be the result. |
Topic | Author | Date |
Keil PK51 problem | 01/01/70 00:00 | |
I guess the following | 01/01/70 00:00 | |
Optimisers are not stupid! | 01/01/70 00:00 | |
just like medicine![]() | 01/01/70 00:00 | |
Keil C51 Compiler | 01/01/70 00:00 |