[sdiy] Re: 1970's again? Now DSP assembly

Martin Fay martin at martinfay.com
Mon Jan 31 09:33:07 CET 2005


Kenneth Elhardt wrote:
> And everytime I hear that C produces the same code or runs just about as
> fast as assembly, I want to scream.  I am constantly horrified by how
> inefficient some C generated code is.  Take this simple FIR filter line I
> wrote in C:
> 
>   for(k=0;k<=510;k++) ftemp+=(fir[k]*(float)*s++);
> 
> No amount of loop unrolling or indexing arrays with pointers could improve
> the speed (they made it slower).  A simple re-write in assembly and it runs
> 3.3 times faster.  Granted, it's Intel's Pentium architecture, the worlds
> worst and most archiac piece is sh*t 32 bit CPU ever.  But anything that
> needs to be done thousands or millions of times a second should always be
> done in assembly.  Plus as you point out, C isn't good at all those logic
> tricks, bitfield operations, vector processing, and so forth.

That C doesn't look like it plays to the x86 architecture to me, but a 
few missing details probably hold the key. What types are fir[] and k? 
Would you mind posting the asm?


Martin




More information about the Synth-diy mailing list