On Friday, 28 September 2012 at 09:43:34 UTC, Timur Gafarov wrote:
dlib is a growing collection of native D language libraries serving as a framework for various higher-level projects - such as game engines, rendering pipelines and multimedia applications. It is written in D2 and has no external external dependencies aside D's standart library, Phobos.

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];


I've also noticed that you've provided Matrix2x2 and Matrix4x4 as separate structs from the more generic Matrix. I'm guessing this is for specialisation. A more idiomatic way to handle this would be to use template specialisation to provide the optimised versions. That way, when people use Matrix!(T, 2, 2) they get all the benefits of Matrix2x2!T as well.

Reply via email to