Overlooked Essentials for Optimizing Code

JimBob jim at bob.com
Sat Sep 11 04:46:42 PDT 2010


"Walter Bright" <newshound2 at digitalmars.com> wrote in message 
news:i6e7tm$jj1$1 at digitalmars.com...
> Nick Sabalausky wrote:
>> "1. Using a profiler
>> 2. Looking at the assembly code being executed"
>>
>> Somehow I knew you were going to say that ;)
>
> What's interesting is how controversial this is. I've heard every reason 
> in the book (and some very inventive ones) justifying not using a profiler 
> or looking at the assembler.

You also need to understand things that can cause problems with asm. For 
example the Borland compiler used to and probably still does often copy 
doubles by using 2 32 bit moves. This means any time they are loaded into 
the fpu soon after a copy you'll get a store to load forwarding stall, which 
can be around 30 cycles penalty. As float/doubles are passed via the stack, 
this meant quite a performance hit for code that used doubles over code that 
used single precision or extended. (Extended was coppied via the FPU so it 
want a problem).



 




More information about the Digitalmars-d mailing list