[Mono-dev] Mono.Simd: Accelerated methods analysis

Bart Masschelein masschel at gmail.com
Sat Dec 6 20:53:58 EST 2008

Hi all,

I've written aprogram that uses reflection to give a list of relevant  
methods in the Mono.Simd, and reports whether they are accelerated or  
not (see below). This small program might be of interest to others, to  
see how well their processor behave.

There are methods that have overloaded, for which I should give the  
signature, but I'm a bit lost in how this signature should look like.  
I tried to convert the ParameterInfo[] of the methods to Type[], as  
required by the IsMethodAccelerated method, but this gives erroneous  
results. Is it only the parameters list, or is there more to it?

I thought of removing the overloaded methods (see list), but I guess I  
might risk to remove relevant methods as well. The overloaded methods  
are mainly op_Explicit, LoadAligned, StoreAligned, and the PrefetchXxx  
methods. Are these relevant to show up in such a list?

Anyway, I'm quite thrilled to see that almost all of the methods are  
accelerated :-).


using System;
using Mono.Simd;
using System.Reflection;

namespace AcceleratedMethods
     class MainClass
         public static void Main(string[] args)
             // Change to your location of Mono.Simd
             string monoSimdLocation = @"/Users/masschel/local/mono/ 
             Assembly assembly = Assembly.LoadFile(monoSimdLocation);
             foreach(Type type in assembly.GetTypes())
                 string typeName = type.Name;
                 if (typeName.Length>=6 && typeName.Substring(0,6) ==  
                     Console.WriteLine("Type {0}", type.Name);
                     foreach(MethodInfo mi in type.GetMethods())
                         string methodName = mi.Name;
                         bool ctu = methodName != "Equals"
                                 && methodName != "GetHashCode"
                                 && methodName != "ToString"
                                 && methodName != "GetType"
                                 && (methodName.Length>=4
                                     && methodName.Substring(0, 4) !=  
                                     && methodName.Substring(0, 4) !=  
                         if (ctu)
                                 Console.WriteLine("   Method {0}  
{1}", mi.Name, SimdRuntime.IsMethodAccelerated(type, mi.Name));
                             // Overloaded methods
(System.Reflection.AmbiguousMatchException amme)
                                 Type[] types = new  
                                 for(int i = 0; i <  
mi.GetParameters().Length; i++)
                                     types[i] = mi.GetParameters() 
AmbiguousMatchException for method {0} {1}", mi.Name,  
SimdRuntime.IsMethodAccelerated(type, mi.Name, types));

More information about the Mono-devel-list mailing list