public static float performExperiment(Action test, FrameTimer timer) { var results = new List <float>(); for (int i = 0; i < EXPERIMENT_COUNT; i++) { timer.Start(); test.Invoke(); timer.Stop(); results.Add(timer.prevFrameTicksInMilliseconds); } return(averageResults(results)); }
public static float performExperimentVector3(Action <Vector3, Vector3> test, FrameTimer timer) { Console.WriteLine("Performing Experiment with Inputs Vector3"); var results = new List <float>(); var v1 = Vector3.One; var v2 = 5 * Vector3.One; for (int i = 0; i < EXPERIMENT_COUNT; i++) { timer.Start(); test.Invoke(v1, v2); timer.Stop(); results.Add(timer.prevFrameTicksInMilliseconds); } return(averageResults(results)); }
public static float performExperimentActionMatrixFSharpTypesbyRef(MatrixMultiplyTest test, FrameTimer timer) { Console.WriteLine("Performing Experiment with Inputs FSharpBench.Numerics.Matrix4x4 By Ref"); var results = new List <float>(); var m1 = new FSharpBench.Numerics.Matrix4x4(1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f); var m2 = new FSharpBench.Numerics.Matrix4x4(1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f); for (int i = 0; i < EXPERIMENT_COUNT; i++) { timer.Start(); test.RunFSharpTestsFSharpTypesByRef(ref m1, ref m2); timer.Stop(); results.Add(timer.prevFrameTicksInMilliseconds); } return(averageResults(results)); }
public static float performExperimentActionMatrix(Action <Matrix4x4, Matrix4x4> test, FrameTimer timer) { Console.WriteLine("Performing Experiment with Inputs Matrix4x4"); var results = new List <float>(); Matrix4x4 m1 = new Matrix4x4(1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f); Matrix4x4 m2 = new Matrix4x4(1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f); for (int i = 0; i < EXPERIMENT_COUNT; i++) { timer.Start(); test.Invoke(m1, m2); timer.Stop(); results.Add(timer.prevFrameTicksInMilliseconds); } return(averageResults(results)); }