Here are the NSort benchmarks for arrays of integer filled with random data. These benchmarks are for the non-generic versions.
The code to generate the benchmarks uses NPerf is given below:
using System; using System.Collections; using NPerf.Framework; namespace NSort.Perf { [PerfTester(typeof(ISorter), 10 , Description = "Sort Algorithm benchmark for Random data" , FeatureDescription = "Collection size")] public class SorterBenchmark { protected int[] list; public int CollectionCount(int testIndex) { int n = 0; if (testIndex < 0) n=10; else n = (testIndex+1)*500; return n; } [PerfRunDescriptor] public double RunDescription(int testIndex) { return (double)CollectionCount(testIndex); } [PerfSetUp] public override void SetUp(int testIndex, ISorter sorter) { Random rnd = new Random(); this.list = new int[CollectionCount(testIndex)]; for (int i = 0; i < this.list.Length; ++i) this.list[i] = rnd.Next(); } [PerfTest] public void SortRandomData(ISorter sorter) { sorter.Sort(this.list); } } }
Page rendered at Friday, August 29, 2008 12:19:37 AM UTC
Disclaimer The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.