Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
07/06/05 13:56
Read: times


 
#96694 - urban legends
Responding to: ???'s previous message
The whole point of 'C' is its platform independence.
In the "small embedded" world ('51 PIC, XA etc) platform independence is an urban legend. The software is so tightly coupled to the hardware that "platform independence" is an illusion.

Performing the sort of 'micro optimisations' being discussed here to save a few cycles may make us feel very clever but are a waste of time unless absolutely necessary. They may actually reduce performance when code is changed elsewhere, or the compiler version is upgraded.
possible, but, to take an example, the "count down a loop" which adapt to the hardware will hardly ever be a deteriment.

If 'micro optimisations' are necessary they are best done in assembler which will indeed require knowledge of the processor.
The discussion is not about 'micro optimisations' which, in the best case, will save a cycle or two, but about habits that will save "save a cycle or two" in hundereds of places. is it 'micro optimisations' to know that, for an 8 bit processor, a char is more efficient than an int - should the compiler have the "intelligence" to change an int to a char, or even a bit, as part of optimization - I would hope not.

"No, there is no need to globally go back to writing assembler, but that does not mean that you do not need to know it."
Indeed, but you don't need to know it to write optimum 'C'.

Here we disagree totally. How can you choose count up or count down without knowing assembler.

I'm not too sure what a 'Cnatic' is.
and
What is this 'real C' stuff anyway?
A Cnatic (C fanatic) is someone that believe that C is universal to the extent that e.g. malloc should be generally used on a '51. "real C" is code written by a Cnatic with total disregard for efficiency.

Erik

List of 54 messages in thread
TopicAuthorDate
code optimization            01/01/70 00:00      
   erm...            01/01/70 00:00      
   guidelines            01/01/70 00:00      
   Duh !!!!            01/01/70 00:00      
      yes its a link to learn optimization            01/01/70 00:00      
         the links provided            01/01/70 00:00      
            Really Wicked Optimisations!            01/01/70 00:00      
            counters in loops?            01/01/70 00:00      
               DJNZ            01/01/70 00:00      
                  ahh            01/01/70 00:00      
                  DOES it ?            01/01/70 00:00      
                     on Keil forum            01/01/70 00:00      
                     Yes!            01/01/70 00:00      
                     Of course it does...            01/01/70 00:00      
                        But...            01/01/70 00:00      
                           asking too much            01/01/70 00:00      
                              Not at all            01/01/70 00:00      
                           Maybe it does...            01/01/70 00:00      
                              Not when I tried it.            01/01/70 00:00      
                                 Lopp Rtation            01/01/70 00:00      
                        While you're there, Jon...            01/01/70 00:00      
                           how like a salt block?            01/01/70 00:00      
                              oh -- got it            01/01/70 00:00      
                           Overlaying and Scope            01/01/70 00:00      
                              Does it matter?            01/01/70 00:00      
                                 debugging            01/01/70 00:00      
   Previously on 8052.com            01/01/70 00:00      
      yes its in the board            01/01/70 00:00      
      IAR Article - Getting the Least            01/01/70 00:00      
   To be taken with a pinch of salt            01/01/70 00:00      
      more like a salt block            01/01/70 00:00      
      Re            01/01/70 00:00      
         switch            01/01/70 00:00      
            Switch/Case Optimization            01/01/70 00:00      
               Re: Switch/Case Optimization            01/01/70 00:00      
                  Look Why            01/01/70 00:00      
               Jon, I may have made a mistake            01/01/70 00:00      
         Big switches            01/01/70 00:00      
         Was?            01/01/70 00:00      
            Link to newer version            01/01/70 00:00      
               Hitex; Chris Hills            01/01/70 00:00      
                  Draft!            01/01/70 00:00      
   intermediate values in lookup tables            01/01/70 00:00      
      Generating lookup tables            01/01/70 00:00      
   a general statement on code optimization            01/01/70 00:00      
      Craft            01/01/70 00:00      
      Corrections            01/01/70 00:00      
         urban legends            01/01/70 00:00      
            Been there.            01/01/70 00:00      
               I think this is closer to the truth            01/01/70 00:00      
                  I just realize that the above            01/01/70 00:00      
               EE/CS            01/01/70 00:00      
            Micro-Optimisations - real-life example            01/01/70 00:00      
               manual optimization            01/01/70 00:00      

Back to Subject List