Re: code optimization in embedded systems



Jyrki Saarinen wrote:
Ken Asbury <avoidingspam2001@xxxxxxxxx> wrote:

We have found this to be largely false. Dropping into assembly
interrupts C optimization, and can thereby eliminate any savings.
Not to sound argumentative, but my experience (and a very good living
over the last 30+ years) has repeatedly demonstrated that, in an
embedded environment, someone familiar with both disciplines can
routinely achieve an order of magnitude improvements in speed of
selected functions. The trick is to be able to determine which
functions to rewrite in assembler.

This must apply only for architectures, for which it is difficult for the compiler to emit good code. If you get order of magnitude improvement in performance when hand-coding a function in assembly, the compiler must be quite bad. The reverse statement might apply on architectures with deep pipelines, several functional units and a large register set.

For the last sentence for yours: one should profile before doing anything else..


Remember that in binary, an order of magnitude is only a factor of two :-)

.