Beispiel #1
0
        static void Main(string[] args)
        {
            var timer = new FrameTimer(1.0);

            var eucliddianDistanceTest = new EuclidianDistanceTest();
            var matrixTest             = new MatrixMultiplyTest();
            var matrixAllocTest        = new MatrixAllocTest();

            Console.WriteLine("Start..");
            float avgTime = 0f;

            avgTime = Experiment.performExperimentActionMatrix(matrixTest.RunFSharpTests, timer);
            Console.WriteLine($"F# Average Time: {avgTime} ms");

            avgTime = Experiment.performExperimentActionMatrix(matrixTest.RunCSharpTests, timer);
            Console.WriteLine($"C# Average Time: {avgTime} ms");

            // avgTime = Experiment.performExperimentVector3(eucliddianDistanceTest.RunFSharpTests,timer);
            // Console.WriteLine($"F# Average Time: {avgTime} ms");

            // avgTime = Experiment.performExperimentVector3(eucliddianDistanceTest.RunCSharpTests,timer);
            // Console.WriteLine($"C# Average Time: {avgTime} ms");
        }
Beispiel #2
0
        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));
        }