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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
08/02/06 14:21
Read: times


 
#121570 - what is best?
Responding to: ???'s previous message
I am very interested in seeing how people on this forum go about optimizing their code. I am usual happy that my functions give me the result I want, and take the "If it ain't broke don't fix it" approach.

That approach is 'the best' when no timing or size issues exsist.
When timing and/or size becomes an issue a few 'explorations in the emulator' will gradually get you the knowledge.

For instance try coding 3 instances with a switch stement, run it through the cycle counter in the simulator and check the size. The try "if - else if - else if - else" and do the same.
Now note, that if you are to replace a switch statement with else you may need more code space, which you may not have, so there will be a trade-off. so what is best? that depends.

Then try a few examples of parameter passing replaced with globally stored values.
Now note, that if you are to replace passed parameters with global values you will need more data space, which you may or may not have, so there will be a trade-off. so what is best? that depends.

Then try the difference between x.y and x->y also x.y.z and x->y->z
Now note, that if you are to replace x->y with x.y you may need to copy a structure and copy it back, so there will be a trade-off. so what is best? that depends

there is no 'pantyhose solution' sometimes 'a' is the best sometines 'b' or 'c'

Experience is a very difficult thing to share.

I can comment on specific cases, but cover in general terms my experience to the full extent - I do not see how.

Erik



List of 33 messages in thread
TopicAuthorDate
code optimisation            01/01/70 00:00      
   Optimisations            01/01/70 00:00      
   problem solved            01/01/70 00:00      
      good closure!            01/01/70 00:00      
         and the very best ...            01/01/70 00:00      
            Isn't that why we have "tools"?            01/01/70 00:00      
               not quite and a good read            01/01/70 00:00      
               A Posidriv driver and a Phillips screw            01/01/70 00:00      
                  I have done this too, I think you are wrong            01/01/70 00:00      
                     Best Ways?            01/01/70 00:00      
                        what is best?            01/01/70 00:00      
                           Guide lines and trade-off\'s            01/01/70 00:00      
                              what about 'and'            01/01/70 00:00      
                                 Dangerous Information            01/01/70 00:00      
                                    depends on what you define as overhead            01/01/70 00:00      
                                       Overhead            01/01/70 00:00      
                                          the whole truth, please            01/01/70 00:00      
                                             one good thing...            01/01/70 00:00      
                                             CPU Overhead            01/01/70 00:00      
                                                there is an article 'somewhere' that cover C for            01/01/70 00:00      
                                                   the real optimum            01/01/70 00:00      
                                                      Your time is appreciated            01/01/70 00:00      
                                                   how about these?            01/01/70 00:00      
                                                      a required capability for optimum code            01/01/70 00:00      
                        small and readable            01/01/70 00:00      
                           my sentiment            01/01/70 00:00      
                              In that spirit ... where's the user guide?            01/01/70 00:00      
                                 Did you download the documentation            01/01/70 00:00      
                                    have a look            01/01/70 00:00      
                                       Non-GPL            01/01/70 00:00      
                                       I'll have a look!            01/01/70 00:00      
                                    It's not quite as the page suggests            01/01/70 00:00      
                        Lint            01/01/70 00:00      

Back to Subject List