dlib - d utility library

Timur Gafarov gecko0307 at gmail.com
Sat Sep 29 00:00:17 PDT 2012


28.09.2012 20:47, Peter Alexander пишет:
> 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.

Thanks! I didn't realize that about vectors. I'm interested in 
performance optimization, so I will fix that as soon as possible.

As for matrices - I used Matrix4x4 for a long time (that was just the 
simplest way), and recently introduced that generalized version. 
Eventually I will port everything into it.


More information about the Digitalmars-d-announce mailing list