예제 #1
0
        private void CloneByCLoop <T>(Cloneable <T> c, Cloneable <T>[] a)
        {
            int count = a.Length;

            for (int i = 0; i < count;)
            {
                a[i++] = c.CloneByC();
                a[i++] = c.CloneByC();
                a[i++] = c.CloneByC();
                a[i++] = c.CloneByC();
                a[i++] = c.CloneByC();
                a[i++] = c.CloneByC();
                a[i++] = c.CloneByC();
                a[i++] = c.CloneByC();
                a[i++] = c.CloneByC();
                a[i++] = c.CloneByC();
            }
        }
예제 #2
0
        private void CloneTest <T>(double speedFactor)
        {
            Random        r = RandomManager.CreateRandom(SeedVariatorType.CallingMethod);
            T             o = InstanceGeneratorProvider.Default.GetInstanceGenerator <T>().GetInstance(r);
            Cloneable <T> c = new Cloneable <T>(o);

            // Warmup
            Cloneable <T>[] a = new Cloneable <T> [100];
            CloneByMCLoop(c, a);
            CloneByCLoop(c, a);
            // Real test
            a = new Cloneable <T> [(int)(CloneTestArrayLength * speedFactor / 10 * 10)];
            TestLog.Info("Cloning test:");
            TestLog.Info("  Type: {0}, length: {1}", c.GetType().GetShortName(), a.Length);
            using (IndentManager.IncreaseIndent()) {
                Cleanup();
                using (new Measurement("MemberwiseClone   ", MeasurementOptions.Log, a.Length))
                    CloneByMCLoop(c, a);
                Cleanup();
                using (new Measurement("CopyingConstructor", MeasurementOptions.Log, a.Length))
                    CloneByCLoop(c, a);
                Cleanup();
            }
        }
예제 #3
0
 public Cloneable(Cloneable <T> source)
 {
     Value = source.Value;
 }