public static void TestListRAM(int amount, int step, int seed, Action <LinkedList, ArrayLong, ArrayLong, ArrayLong, ArrayLong> algorithm) { var title = " " + algorithm.Method.DeclaringType.Name + ": Linked list in RAM"; Console.WriteLine(new string('_', 119)); Console.WriteLine("{0,-34}{1,14}{2,10}{3,22}", title, "Current", "Total", "Elapsed time (ms)"); for (var i = 0; i < RunCount; i++) { ComparisonCount = 0; SwapCount = 0; var sample = new LinkedListRAM(amount, seed); var a = new ArrayLongRAM(amount); var t = new ArrayLongRAM(amount); var count = new ArrayLongRAM(1 << RadixSort.GroupLength); var pref = new ArrayLongRAM(1 << RadixSort.GroupLength); _stopwatch = Stopwatch.StartNew(); algorithm(sample, a, t, count, pref); _stopwatch.Stop(); DrawTextProgressBar(amount, amount); Console.WriteLine(); LogResults(title, amount); amount *= step; } }
public static void TestArrayRAM(int amount, int step, int seed, Action <Array, ArrayLong, ArrayLong, ArrayLong, ArrayLong> algorithm) { // ReSharper disable once PossibleNullReferenceException var title = " " + algorithm.Method.DeclaringType.Name + ": Array in RAM"; Console.WriteLine(new string('_', 119)); Console.WriteLine("{0,-34}{1,13}{2,14}{3,10}{4,16}{5,10}{6,22}", title, " Progress", "Current", "Total", "Comparisons", "Swaps", "Elapsed time (ms)"); for (var i = 0; i < RunCount; i++) { ComparisonCount = 0; SwapCount = 0; var sample = new ArrayRAM(amount, seed); var a = new ArrayLongRAM(amount); var t = new ArrayLongRAM(amount); var count = new ArrayLongRAM(1 << RadixSort.GroupLength); var pref = new ArrayLongRAM(1 << RadixSort.GroupLength); _stopwatch = Stopwatch.StartNew(); algorithm(sample, a, t, count, pref); _stopwatch.Stop(); DrawTextProgressBar(amount, amount); Console.WriteLine(); LogResults(title, amount); //sample.Print(); amount *= step; } }