Greg Mountford

Code Optimization (for speed)?

Discussion created by Greg Mountford on Jan 8, 2009
Latest reply on Feb 17, 2009 by Bob Cousins
Hi,

I'm using CW7.3 on the DSP56F805EVM board and I need my code to run as quickly as possible.

1) Will the code run faster if all variables are declared as signed rather than unsigned - or does the built is optimization correct these for the quickest possible operation?

2) Which will result in fewer instructions, a for( ; ; ) or a while(1)? In an un-optimized environment, the while(1) would result in a fetch from ROM, a compare & goto - whereas a for( ; ; ) would result in just a goto. Does the compiler optimize the while(1) correctly to just a goto?
(yes - I am stretching for clock cycles)

3) Can anyone provide me with more tips/tricks/techniques to code for speedy execution?

Code size is not a worry - it's the execution time I need to get down, whilst still coding in C.

Thanks for any assistance,

Greg

Outcomes