Exemplo n.º 1
0
        public void TestQueue()
        {
            var queue = new FifoPositionQueue();

            for (int i = 0; i < Elements; i++)
            {
                queue.Enqueue(_toAddX[i], _toAddY[i]);
            }
        }
        public void SpillFlood_HugeOpenArea_ScanlineAndNormalPerformanceComparison()
        {
            int size   = 1000;
            var result = new int[size, size];

            var startPosition = new Position(size / 2, size / 2);
            var queue         = new FifoPositionQueue();
            var parameters    = new FloodParameters(queue, startPosition.X, startPosition.Y);

            var stopwatch = Stopwatch.StartNew();

            new FloodScanlineSpiller().SpillFlood(parameters, result);
            Console.WriteLine("scanline:" + stopwatch.ElapsedMilliseconds);
            stopwatch.Restart();


            new FloodSpiller().SpillFlood(parameters, result);
            Console.WriteLine("normal:" + stopwatch.ElapsedMilliseconds);
        }