Advertisement
Guest User

Untitled

a guest
Jun 28th, 2017
194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.04 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Diagnostics;
  4. using System.Text;
  5. using Wintellect.PowerCollections;
  6.  
  7. namespace ConsoleApp12
  8. {
  9.     class Program
  10.     {
  11.         static void Main()
  12.         {
  13.             const int operations = 200_000;
  14.             Stopwatch watch = new Stopwatch();
  15.             Random random = new Random();
  16.             //List
  17.             watch.Start();
  18.             List<char> justNormalList = new List<char>();
  19.             for (int i = 0; i < operations; i++)
  20.             {
  21.                 justNormalList.Insert(random.Next(0, i), 'a');
  22.             }
  23.             watch.Stop();
  24.             Console.WriteLine(watch.Elapsed);
  25.             //BigList
  26.             watch = new Stopwatch();
  27.             watch.Start();
  28.             BigList<char> bigList = new BigList<char>();
  29.             for (int i = 0; i < operations; i++)
  30.             {
  31.                 bigList.Insert(random.Next(0, i), 'a');
  32.             }
  33.             watch.Stop();
  34.             Console.WriteLine(watch.Elapsed);
  35.         }
  36.     }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement