Esempio n. 1
0
        public List <ExperimentResult> Measure(IRunner runner, int repetitionsCount)
        {
            List <ExperimentResult> results = new List <ExperimentResult>();
            Stopwatch watch;

            foreach (int count in Constants.FieldCounts)
            {
                runner.Call(false, count, 1);
                watch = new Stopwatch();
                watch.Start();
                runner.Call(false, count, repetitionsCount); watch.Stop();
                double timeStruct = (double)watch.ElapsedMilliseconds / repetitionsCount;

                runner.Call(true, count, 1);
                watch = new Stopwatch();
                watch.Start();
                runner.Call(true, count, repetitionsCount);
                watch.Stop();
                double timeClass = (double)watch.ElapsedMilliseconds / repetitionsCount;

                results.Add(new ExperimentResult(count, timeClass, timeStruct));
            }

            return(results);
        }
Esempio n. 2
0
        private static long GetCallTime(bool isClass, IRunner runner, int repetitionsCount, int fieldCount)
        {
            runner.Call(isClass, fieldCount, 1);
            var sStopwatch = Stopwatch.StartNew();

            runner.Call(isClass, fieldCount, repetitionsCount);
            return(sStopwatch.ElapsedMilliseconds);
        }
Esempio n. 3
0
        private double test(bool isClass, IRunner runner, int repetitionsCount, int fieldCount)
        {
            var timer = Stopwatch.StartNew();

            runner.Call(isClass, fieldCount, 1);
            timer.Restart();
            runner.Call(isClass, fieldCount, repetitionsCount);
            return(timer.Elapsed.TotalMilliseconds / repetitionsCount);
        }
Esempio n. 4
0
        double SpeedTime(IRunner runner, bool isClass, int size, int count)
        {
            var timer = new Stopwatch();

            timer.Start();
            runner.Call(isClass, size, count);
            timer.Stop();
            return((double)timer.ElapsedMilliseconds / count);
        }
        public List <ExperimentResult> Measure(IRunner runner, int repetitionsCount)
        {
            foreach (var size in Constants.FieldCounts)
            {
                runner.Call(false, size, 1);
                watch.Restart();
                runner.Call(false, size, repetitionsCount);
                watch.Stop();
                time1 = (double)watch.ElapsedMilliseconds / repetitionsCount;
                runner.Call(true, size, 1);
                watch.Restart();
                runner.Call(true, size, repetitionsCount);
                watch.Stop();
                time2 = (double)watch.ElapsedMilliseconds / repetitionsCount;
                result.Add(new ExperimentResult(size, time2, time1));
            }

            return(result);
        }
        private double PerformExperiment
            (IRunner runner, bool isClass, int fieldCount, int repetitionsCount)
        {
            var watch = new Stopwatch();

            watch.Start();
            runner.Call(isClass, fieldCount, repetitionsCount);
            watch.Stop();

            return((double)watch.ElapsedMilliseconds / repetitionsCount);
        }
Esempio n. 7
0
        public List <ExperimentResult> Measure(IRunner runner, int repetitionsCount)
        {
            var result      = new List <ExperimentResult>();
            var classWatch  = new Stopwatch();
            var structWatch = new Stopwatch();

            foreach (var size in Constants.FieldCounts)
            {
                runner.Call(true, size, 1);
                runner.Call(false, size, 1);
                classWatch.Restart();
                runner.Call(true, size, repetitionsCount);
                classWatch.Stop();
                structWatch.Restart();
                runner.Call(false, size, repetitionsCount);
                structWatch.Stop();
                var totalClassTime  = classWatch.ElapsedMilliseconds / (double)repetitionsCount;
                var totalStructTime = structWatch.ElapsedMilliseconds / (double)repetitionsCount;
                result.Add(new ExperimentResult(size, totalClassTime, totalStructTime));
            }
            return(result);
        }