private static void Test(int count, int k, Algo algo, int b = 65536) { Console.WriteLine("Test " + algo + " on " + count + " elements, k = " + k + " b = " + b); // always produce the same pseudo-random numbers m_z = 6531; m_w = 1365801; System.IO.StreamWriter file = new System.IO.StreamWriter("result.txt", true); var before = DateTime.UtcNow; IList <uint> list; switch (algo) { case Algo.List: list = new List <uint>(count); break; case Algo.External: list = new ExternalMemoryList <uint>("directory", count / k); break; default: list = new KMerge <uint>("directory", k, b); break; } for (int i = 0; i < count; i++) { list.Add(get_random()); } var then = DateTime.UtcNow; if (list is List <uint> ) { (list as List <uint>).Sort(); } else { (list as ExternalMemoryList <uint>).Sort(); } var now = DateTime.UtcNow; Console.WriteLine("===" + list.ToString() + " on " + count + " elements:"); Console.WriteLine("All:" + (now - before)); Console.WriteLine("Sort: " + (now - then)); Console.WriteLine("==================================="); file.WriteLine("===" + list.ToString() + " on " + count + " elements:"); file.WriteLine("All:" + (now - before)); file.WriteLine("Sort: " + (now - then)); file.WriteLine("==================================="); file.Close(); }
internal Enumerator(ExternalMemoryList <T> colletion) { this.collection = colletion; }