Example #1
0
        private void CachedRawPerformance(int repeats)
        {
            var dt = AllType.GetTableCached();

            for (int i = 0; i < repeats; i++)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    PerformanceAllType inst = new PerformanceAllType();
                    inst.Fill(dr);
                }
            }
        }
Example #2
0
        //[TestMethod]
        public void CompareUncachedPerformance()
        {
            Stopwatch sw = new Stopwatch();

            sw.Start();
            sw.Stop();
            sw.Reset();
            AllType.GetTable();

            const int reps = 10000;

            sw.Start();
            for (int i = 0; i < reps; i++)
            {
                var dt = AllType.GetTable();
                foreach (DataRow dr in dt.Rows)
                {
                    AllType inst = new AllType();
                    inst.Fill(dr);
                }
            }
            sw.Stop();
            Console.WriteLine("DaLi uncached (" + reps + "): " + sw.ElapsedMilliseconds.ToString());
            sw.Reset();
            sw.Start();
            for (int i = 0; i < reps; i++)
            {
                var dt = AllType.GetTable();
                foreach (DataRow dr in dt.Rows)
                {
                    PerformanceAllType inst = new PerformanceAllType();
                    inst.Fill(dr);
                }
            }
            sw.Stop();
            Console.WriteLine("Raw implementation uncached (" + reps + "): " + sw.ElapsedMilliseconds.ToString());
        }