<p>Some years ago I was on a panel that was interviewing candidates for a relatively senior embedded C programmer position.</p>

<p>One of the standard questions that I asked was about optimisation techniques. I was quite surprised that some of the candidates didn't have answers.</p>

<p>So, in the interests of putting together a list for posterity - what techniques and constructs do you normally use when optimising C programs?</p>

<p>Answers to optimisation for speed and size both accepted.</p>

Collecting profiles of code execution get you 50% of the way there. The other 50% deals with analyzing these reports.
Further, if you use GCC or VisualC++, you can use "profile guided optimization" where the compiler will take info from previous executions and reschedule instructions to make the CPU happier.