New slides about Go

Nick Sabalausky a at a.a
Thu Oct 14 20:00:08 PDT 2010


"Walter Bright" <newshound2 at digitalmars.com> wrote in message 
news:i98frv$1dm2$1 at digitalmars.com...
> bearophile wrote:
>> Nick Sabalausky:
>>
>>> Then you're wasting cycles every iteration (by doing an extra addition 
>>> and maybe an extra shift or even multiplication depending on T: Ie, 
>>> (cast(ubyte*)myArray.ptr) + i * T.sizeof). That was a pretty common 
>>> inner-loop optimization back in my C days.
>>
>> With D sometimes array-based code is faster than pointer-based. With LDC 
>> they are usually equally efficient.
>
> ??? This makes no sense.
>
> The (ptr+i*T.sizeof) is an addressing mode on the x86, and comes at ZERO 
> cost.
>

Guess it's been way too long since I've touched x86 asm and my memory's 
warped :/

OTOH, not all platforms are x86 (but maybe that's still a common thing on 
other architectures).




More information about the Digitalmars-d mailing list