static void HashSetBenchmark(int samples, int numOfOperations) { List <BenchmarkResults> hashsetResults = new List <BenchmarkResults>(samples); ResultsManager hashSetResultsManager = new ResultsManager() { CollectionName = "HashSet", NumberOfOperations = numOfOperations }; for (int i = 0; i < samples; i++) { Benchmark benchmark = new Benchmark(new HashSetTest(numOfOperations)); hashsetResults.Add(benchmark.PerformAllTests()); Console.WriteLine(hashSetResultsManager.CollectionName + " progress: " + i + "/" + samples); } hashSetResultsManager.SaveToCsv(hashsetResults, "CSharp_HashSetTest.csv"); }
static void DictionaryBenchmark(int samples, int numOfOperations) { List <BenchmarkResults> dictionaryResults = new List <BenchmarkResults>(samples); ResultsManager dictResultsManager = new ResultsManager() { CollectionName = "Dictionary", NumberOfOperations = numOfOperations }; for (int i = 0; i < samples; i++) { Benchmark benchmark = new Benchmark(new DictionaryTest(numOfOperations)); dictionaryResults.Add(benchmark.PerformAllTests()); Console.WriteLine(dictResultsManager.CollectionName + "progress: " + i + "/" + samples); } dictResultsManager.SaveToCsv(dictionaryResults, "CSharp_DictionaryTest.csv"); }