Re: code optimization in embedded systems
- From: David Brown <david@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Mon, 19 Nov 2007 10:40:14 +0100
Jyrki Saarinen wrote:
Ken Asbury <avoidingspam2001@xxxxxxxxx> wrote:
We have found this to be largely false. Dropping into assemblyNot to sound argumentative, but my experience (and a very good living
interrupts C optimization, and can thereby eliminate any savings.
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 :-)