Example #1
0
        private void button5_Click(object sender, EventArgs e)
        {
            Console.WriteLine("Starting single threaded bench");
            GC.Collect();
            Stopwatch sw = new Stopwatch();

            tribe = new TribeST(2, 1, 128);
            sw.Start();
            for (int st = 0; st < 1000; st++)
            {
                for (int i = 0; i < 100; i++)
                {
                    tribe.Mutate();
                }
                tribe.Evaluate(_and);
                for (int i = 0; i < 100; i++)
                {
                    tribe.Purge();
                }
                tribe.Reproduce();

                tribe.Evaluate(_and);
            }
            sw.Stop();
            Console.WriteLine("Single Threading: " + sw.Elapsed);


            GC.Collect();
            Console.WriteLine("Starting multi threaded bench");
            //tribe = new TribeMT(2, 1, 128);
            sw.Reset();
            sw.Start();
            for (int st = 0; st < 1000; st++)
            {
                for (int i = 0; i < 100; i++)
                {
                    tribe.Mutate();
                }
                tribe.Evaluate(_and);
                for (int i = 0; i < 100; i++)
                {
                    tribe.Purge();
                }
                tribe.Reproduce();

                tribe.Evaluate(_and);
            }
            sw.Stop();
            Console.WriteLine("Multi Threading: " + sw.Elapsed);
        }
Example #2
0
 private void btnReproduce_Click(object sender, EventArgs e)
 {
     ClearPictureBoxes();
     tribe.Reproduce();
     InitializePictureBoxes();
 }