Ejemplo n.º 1
0
        public static void UnitTest_Performance12_4()
        {
            Test01[] arr = new Test01[T12_NOBJS];
            for (int i = 0; i < arr.Length; i++)
            {
                var obj = new Test01();
                arr[i] = obj;
                obj.A  = i;
                obj.B  = (i + 1).ToString();
                obj.C  = 2 * i;
            }

            System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
            sw.Start();

            for (int i = 0; i < T12_NLOOP; ++i)
            {
                var obj  = arr[i % T12_NOBJS];
                var obj2 = arr[(i + 1) % T12_NOBJS];
                obj.A = obj2.A;
                obj.B = obj2.B;
                obj.C = obj2.C;
            }
            sw.Stop();
            Console.WriteLine("time:" + sw.ElapsedMilliseconds);
        }
Ejemplo n.º 2
0
        public static void UnitTest_Performance12()
        {
            System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
            sw.Start();

            Test01[] arr = new Test01[T12_NOBJS];
            for (int i = 0; i < T12_NLOOP; i++)
            {
                arr[i % T12_NOBJS] = new Test01();
            }

            sw.Stop();
            Console.WriteLine("time:" + sw.ElapsedMilliseconds);
        }