コード例 #1
0
        static void Main(string[] args)
        {
            var noise = new SimplexNoise();

            var operationTimer = new OperationTimer();
            var elapsedTime    = operationTimer.TimeOperation(() =>
            {
                const int upperLimit = NumberOfCalculations * Iterations;
                for (int i = 0; i < upperLimit; i++)
                {
                    var d = noise.Noise(i, i, i);
                }
            });

            Console.WriteLine(elapsedTime.TotalSeconds);

            elapsedTime = operationTimer.TimeOperation(() => Parallel.For(0, Iterations, CalculateNoise));
            Console.WriteLine(elapsedTime.TotalSeconds);
        }
コード例 #2
0
        static void Main(string[] args)
        {
            var noise = new SimplexNoise();

            var operationTimer = new OperationTimer();
            var elapsedTime = operationTimer.TimeOperation(() =>
                                                               {
                                                                   const int upperLimit = NumberOfCalculations * Iterations;
                                                                   for (int i = 0; i < upperLimit; i++)
                                                                   {
                                                                       var d = noise.Noise(i, i, i);
                                                                   }
                                                               });

            Console.WriteLine(elapsedTime.TotalSeconds);

            elapsedTime = operationTimer.TimeOperation(() => Parallel.For(0, Iterations, CalculateNoise));
            Console.WriteLine(elapsedTime.TotalSeconds);
        }