Exemple #1
0
 static void SmallTest()
 {
     string input = @"C:\tmpSort\BigFile.txt";
     string output = @"C:\tmpSort\output.txt";
     Console.WriteLine("Begin Data Gen");
     var swGen = new System.Diagnostics.Stopwatch();
     swGen.Start();
     Test.GenFile(1, 100000, 1000*100, new System.Random(51), input);
     swGen.Stop();
     Console.WriteLine("Data Gen Time: {0}", swGen.Elapsed.ToString());
     var sw = new System.Diagnostics.Stopwatch();
     sw.Start();
     var opt = new ExternalMergeSort.Options(100, 10, 5); //ExternalMergeSort.sizeFromMB(1), ExternalMergeSort.sizeFromMB(1) / 10);
     //var opt = new ExternalMergeSort.Options(100000, 10000); //ExternalMergeSort.sizeFromMB(1), ExternalMergeSort.sizeFromMB(1) / 10);
     ExternalMergeSort.Sort(input, output, @"C:\tmpSort\tmp\", opt);
     sw.Stop();
     Console.WriteLine("Total Sort Time: {0}", sw.Elapsed.ToString());
     Test.TestResult(input, output);
 }
Exemple #2
0
        static void LargeTest()
        {
            string input = @"c:\tmpSort\BigFile.txt";
            string tempDir = @"c:\tmpSort\tmp\";
            string output = @"c:\tmpSort\output1.txt";

            Console.WriteLine("Begin Data Gen");
            var swGen = new System.Diagnostics.Stopwatch();
            swGen.Start();
            Test.GenFile(50, 100000000, 100000, new System.Random(51), input);
            swGen.Stop();
            Console.WriteLine("Data Gen Time: {0}", swGen.Elapsed.ToString());
            var sw = new System.Diagnostics.Stopwatch();
            sw.Start();
            var opt = new ExternalMergeSort.Options(ExternalMergeSort.sizeFromMB(200), ExternalMergeSort.sizeFromMB(10 /*0*/ /*10*/) / 10, 1024 * 10);
            opt.SkipInitialSort = false;
            ExternalMergeSort.Sort(input, output, tempDir, opt);
            sw.Stop();
            Console.WriteLine("Total Sort Time: {0}", sw.Elapsed.ToString());
            //Test.TestResult(input, output);//cannot test for large files with this code
        }