[Mono-dev] Mono.Simd API Suggestions

Rodrigo Kumpera kumpera at gmail.com
Thu Nov 6 09:21:35 EST 2008


Hi Jonathan,

Answering your others suggestions.

Other suggestions:

>SimdRuntime.IsMethodAccelerated() and
>SimdRuntime.MethodAccelerationMode() should be overloaded to accept a
>MethodInfo of the desired method, as it can be ~trivial to get a
>MethodInfo in a static, type-checked fashion, e.g.:

>	MethodInfo average = ((Func<Vector8us, Vector8us, Vector8us>)
>		Vector8us.Average).Method;
>	bool b = SimdRuntime.IsMethodAccelerated (average);

Your idea is quite interesting. The MethodInfo overload is kind of useful, but
letting the user just pass a delegate for the proper type is way nicer.

>Even better, this is _faster_ than typeof(Vector8us).GetMethod
>("Average").  (Not by a lot, but faster nonetheless.)

Well, speed is irrelevant on this case as this is a startup thing and it doesn't
make sense to use it during execution.


>AccelerationAttribute should be AcceleratedOnAttribute, and AccelMode
>should be InstructionSet.  I think this would make for more readable
>documentation prototypes:

Makes sense.


>Finally (for now), parameter names should be more consistent.  On some
>methods the arguments are (va, vb) (e.g. Vector8us.Average()), while on
>others they're (v1, v2) (e.g. Vector2d.InterleaveHigh()).  I don't care
>which we choose, but we should stick to something and use it
>consistently (`a` and `b`, perhaps?).

There is little consistency on this and sticking to a single naming
will be relevant once
C# 4.0 is released.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20081106/f8e8c8c3/attachment.html 


More information about the Mono-devel-list mailing list