Change representation of dynamic arrays?

David Brown dlang at davidb.org
Fri Oct 19 22:36:52 PDT 2007


On Sat, Oct 20, 2007 at 01:11:44PM +1000, Daniel Keep wrote:

>You say you've measured the performance of loops using this, but what
>about slicing code?  I know that I use a lot of [lower..$-something]
>style code; how much slower does this become?  Once I'm not so busy, I
>might try to work out the proportion of foreach to $ slicing in my code. :P

I wouldn't expect the performance to change in this case.  You're doing an
addition to adjust the start pointer, and a subtraction to adjust the
length.  The new representation would do the same addition and subtraction.

In fact, it looks like it would even generate the same code.

David



More information about the Digitalmars-d mailing list