Results are in: static foreach is a slower than hand unrolling yourloops or using mixins.
Gareth Charnock
gareth at oerc.ox.ac.uk
Fri Apr 30 12:16:13 PDT 2010
I don't actually know assembly language so no, this is all purely
empirical.
BCS wrote:
> Hello Gareth,
>
>> I managed to get some free time to look at this and it would appear
>> that static foreach is slower than hand unrolling a loop. Fortunately
>> there are no detectable differences between hand unrolling a loop and
>> building the body of the loop in a compile time string and using a
>> mixin. Results are here:
>
> Last time I checked, static foreach tended to load the index onto the
> stack for each iteration even if it was never used. Did you take a look
> at the ASM?
>
More information about the Digitalmars-d
mailing list