[Mono-dev] Mono SIMD Function Declarations and Timing

Stefanos A. stapostol at gmail.com
Fri Nov 21 04:10:06 EST 2008

On Fri, 2008-11-21 at 09:04 +0000, Alan McGovern wrote:
> Hey,
> > Would you care to do the same tests on Mono and .Net using "class" instead
> > of "struct" to see what happens? It would be interesting to look at. Also,
> > include object creation in that as well. Thanks.
> There's nothing new here. Passing a struct which is larger than the
> size of a pointer by value will always be slower than passing a class.
> Passing a Vector4d by value, which is 8 times larger than a pointer on
> a 32bit system, is going to be slower than passing it by ref. There's
> nothing that can be done about that other than using a different
> overload for adding.
> static void Vector4d Add (ref Vector4d first, ref Vector4d second, out
> Vector4d result)

True. We did some testing in OpenTK and found out that passing structs
by reference is by far the fastest way (using exactly this declaration).
Using classes was slightly slower, but the test did not factor heap
allocations in.

More information about the Mono-devel-list mailing list