コード例 #1
0
        private static void InsertInTheMiddlePerformanceTets()
        {
            Console.WriteLine("Insert in the middle test!");
            rope  = new BigList <string>();
            sb    = new StringBuilder();
            timer = new Stopwatch();

            timer.Start();
            for (int i = 0; i < iterations; i++)
            {
                rope.Insert(rope.Count / 2, word);
            }
            PrintTime();

            timer.Start();
            for (int i = 0; i < iterations; i++)
            {
                sb.Insert(sb.Length / 2, word);
            }
            PrintTime();
        }
コード例 #2
0
        private static void AppendPerformanceTest()
        {
            Console.WriteLine("Append string test!");
            rope  = new BigList <string>();
            sb    = new StringBuilder();
            timer = new Stopwatch();

            timer.Start();
            for (int i = 0; i < iterations; i++)
            {
                rope.Add(word);
            }
            PrintTime();

            timer.Start();
            for (int i = 0; i < iterations; i++)
            {
                sb.Append(word);
            }
            PrintTime();
        }
コード例 #3
0
        private static void PrependPerformanceTest()
        {
            Console.WriteLine("Insert string in the begining test!");
            rope  = new BigList <string>();
            sb    = new StringBuilder();
            timer = new Stopwatch();

            timer.Start();
            for (int i = 0; i < iterations; i++)
            {
                rope.Insert(0, word);
            }
            PrintTime();

            timer.Start();
            for (int i = 0; i < iterations; i++)
            {
                sb.Insert(0, word);
            }
            PrintTime();
        }