Small Vectors Proposal

Knud Soerensen 4tuu4k002 at sneakemail.com
Fri Feb 2 08:42:33 PST 2007


I think it is better to make very general framework for describing the
vector operations, because when we have a very general description 
then the compiler is free to optimize as it sees fit.
You can think at it as a SQL for vector operations.
See http://all-technology.com/eigenpolls/dwishlist/index.php?it=10
There is also a suggestion for a general form of Swizzle operations
http://all-technology.com/eigenpolls/dwishlist/index.php?it=11

I think that you forget that a program using vectors typical use a lot 
of them and therefor it needs to transform a lot at a time.

Exsample take a models using 1000 vectors.

Your suggestion would suggest defining it like 
float3 model[1000].
and it would suggest that they where placed in memory as
x1 y1 z1
x2 y2 z2
x3 y3 z3
.
.
.

each vector following each other.

But now imagine that the most used operation in the program 
is a plan projection on the x-y plan, then we only need the x and y
coordinate.
So an arrangement in memory which looks like 
x1 x2 x3 . . .
y1 y2 y3 . . .
z1 z2 z3 . . .
would result in that the cpu could specific load only the x and the y
coordinates into the cache, which would speed up the calculations a lot.

So, if one could specify that 3x1000 floats and let the compiler
arrange them in memory that would be optimal.



More information about the Digitalmars-d mailing list