private static double TestRunVoidWithCachedCall() { var instance = new TestObject(); var cachedCall = CachedCallFactory.Create(instance, "Run", new Type[] {}); var start = System.DateTime.Now; for (var i = 0; i < runCounts; i++) { cachedCall.Invoke(null); } var cost = (System.DateTime.Now - start).TotalMilliseconds; return(cost); }
private static double RunOneArgWithCachedCall() { var instance = new TestObject(); var cachedCall = CachedCallFactory.Create(instance, "Run", new Type[] { typeof(int) }); var args = new object[] { 1 }; var start = System.DateTime.Now; for (var i = 0; i < runCounts; i++) { cachedCall.Invoke(args); } var cost = (System.DateTime.Now - start).TotalMilliseconds; return(cost); }
public static bool IsCallSupport(params System.Type[] types) { if (types.Length > 4) { return(false); } var hasValueType = false; foreach (var tp in types) { if (tp.IsValueType) { hasValueType = true; } } if (!hasValueType) { return(true); } var cachedCallType = CachedCallFactory.MakeCachedCallGenericType(types); return(_supportCacheCallType.Contains(cachedCallType)); }