On 2012-09-28 19:47, Peter Alexander wrote:
A note on your Vector implementation. Currently you use the vector operators, e.g.Vector!(T,size) opAddAssign (Vector!(T,size) v) body { arrayof[] += v.arrayof[]; return this; } This is fine for large vectors, but (correct me if I'm wrong), your vector class appears to be designed for small vectors. Those vector ops currently call a asm optimised function that uses SIMD instructions in a loop - it works well for larger vectors with hundreds of elements, but for small vectors it's significantly faster to just use: foreach (i; 0..size) arrayof[i] += v.arrayof[i];
Isn't the whole point of the array operators that it gives the compiler more semantic understanding of the code. Just as a foreach-loop does compared to a for-loop. So the compiler should be able to optimize this and generated the most optimal code. But the compiler might not be that good.
-- /Jacob Carlborg
