"Lutger" <lutger.blijdest...@gmail.com> wrote in message 
news:i5jiap$rv...@digitalmars.com...
> dsimcha wrote:
>
> ...
>>> My suggestion is to include a mixin for unrolling loops.
>>
>> I thought about this.  Simple loop unrolling doesn't seem like a very 
>> useful
>> optimization on modern hardware because branch prediction and pipelining 
>> have
>> gotten so good.

We shouldn't forget, D is supposed to be a systems language, so it needs to 
work well for a variety of embedded systems. We can't assume all CPUs are 
going to be just as advanced as a modern desktop CPU. Plus, as a systems 
language, we shouldn't rule out people who have a reason to optimize for 
lower-end hardware.


>>It can still be useful if you also change the loop body a
>> little, for example using multiple accumulators to increase instruction 
>> level
>> parallelism,
>> but this is hard to write generically.  I can't think of a way to write 
>> such a
>> mixin such that it would be both generic and useful.
>
> Probably not for performance, but as a utility for metaprogramming I find 
> it
> sometimes convenient.

Isn't performance the whole point of loop unrolling? What other use could 
there be?


Reply via email to