dsimcha:
> 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.  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.

Today loop unrolling is still a basic tool for optimization. Dynamic loop 
unrolling is one of the most important optimizations done today by the Sun 
JavaVM.

My best code for loop unrolling is inside bug 4085, but as I have explained 
there I think it's not a good idea to add it to Phobos. It's better to add even 
a very minimal version of static foreach in the language (despite what Andrej 
Mitrovic has recently said).

Bye,
bearophile

Reply via email to