Vector performance

F i L witte2008 at gmail.com
Wed Jan 11 16:46:55 PST 2012


Manu wrote:
> Define 'flexible'?
> Probably not very flexible, they will be fast!

Flexible as in my examples.


> I think the term 'iteration' is a bit ugly/misleading though, 
> it should be
> 't' or 'time'.

I've tried to come up with a better term. I guess the logic 
behind 'iteration' (which i got from someone else) is that an 
iteration of 2 gives you a value of two distances from start to 
target. Whereas 'time' (or 't') could imply any measurement, eg, 
seconds or hours. Maybe 'tween', as in between? idk, i'll keep 
looking.


> I would probably make a transition of matrices, rather than a 
> matrix of
> vector transitions (so you can get references to the internal 
> matrices)...

Well the idea is you can have both. You could even have a:

    Vector2!(Transition!(Vector4!(Transition!float))) // headache
    or something more practical...

    Vector4!(Vector4!float) // Matrix4f
    Vector4!(Transition!(Vector4!float)) // Smooth Matrix4f

Or anything like that. I should point out that my example didn't 
make it clear that a Matrix4!(Transition!float) would be 
pointless compared to Transition!(Matrix4!float) unless each 
Transition held it's own iteration value. Example:

    struct Transition(T, bool isTimer = false) {
        T value, start, target;
        alias value this;

        static if (isTimer) {
            float time, speed;

            void update() {
                time += speed;
                value = start + ((target - start) * time);
            }
        }
    }

That way each channel could update on it's own time frame. There 
may even be a way to have each channel be it's own separate 
Transition type. Which could be interesting. I'm still playing 
with possibilities.


> I think that is also possible if that's what you want to do, 
> and I see no
> reason why any of these constructs wouldn't be efficient (or 
> supported).
> You can probably even try it out now with what Walter has 
> already done...

Cool, I was unaware Walter had begun implementing SIMD 
operations. I'll have to build DMD and test them out. What's the 
syntax like right now?

I was under the impression you would be helping him here, or that 
you would be building the SIMD-based math libraries. Or something 
like that. That's why I was posting my examples in question to 
how the std.simd lib would compare.


More information about the Digitalmars-d mailing list