Example #1
0
        static void TestOtherThing()
        {
            var kiekiai = new int[] { 1000, 2500, 5000, 7500, 10000 };
            var timer   = new Stopwatch();
            var seed    = 521324;

            Console.WriteLine("Test F");
            Console.WriteLine("{0, -10}| {1, -20}", "Quantity", "Time");

            var i = 0;

            foreach (var k in kiekiai)
            {
                var lygtis = new Lygtis(k);
                lygtis.TestWithRecursion(seed + i);

                i += 5;
            }

            i = 0;
            foreach (var k in kiekiai)
            {
                var lygtis = new Lygtis(k);
                timer.Reset();
                timer.Start();
                lygtis.TestWithRecursion(seed + i);
                timer.Stop();
                Console.WriteLine("{0, -10}| {1, -20}", k, timer.Elapsed);

                i += 5;
            }

            Console.WriteLine("Test parallel F");
            Console.WriteLine("{0, -10}| {1, -20}", "Quantity", "Time");

            i = 0;
            foreach (var k in kiekiai)
            {
                var lygtis = new Lygtis(k);
                lygtis.TestParallel(seed + i);

                i += 5;
            }

            i = 0;
            foreach (var k in kiekiai)
            {
                var lygtis = new Lygtis(k);
                timer.Reset();
                timer.Start();
                lygtis.TestParallel(seed + i);
                timer.Stop();
                Console.WriteLine("{0, -10}| {1, -20}", k, timer.Elapsed);

                i += 5;
            }
        }
Example #2
0
        public void Greitaveika()
        {
            var kiekiai = new List <int> {
                100, 500, 1000, 2500, 5000
            };
            var timer = new Stopwatch();

            Console.WriteLine("{0,-15}|{1,-15}", "Kiekis", "Laikas");
            kiekiai.ForEach(k =>
            {
                timer.Reset();
                timer.Start();
                var uzd = new Lygtis(k);
                uzd.TestWithRecursion(123);
                timer.Stop();
                Console.WriteLine("{0,-15}|{1,20}", k, timer.Elapsed);
            });
        }