New slides about Go
JimBob
jim at bob.com
Fri Oct 15 00:55:48 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.
As long as T.sizeof is either 1, 2, 4, or 8 bytes.
More information about the Digitalmars-d
mailing list