public static EzChartForm StartOnNewThread(bool example = false) { EzChartForm form = new EzChartForm(example); new Thread(() => System.Windows.Forms.Application.Run(form)).Start(); return(form); }
public static void Main() { // Obtain the word list string wordList = Benchmark.Resources.Resources.WordList; string[] words = wordList.Split(new string[] { "\n", "\r\n" }, StringSplitOptions.RemoveEmptyEntries); RunMenu(new Pair <string, Action>[] { new Pair <string, Action>("Convex Hull", Benchmarks.ConvexHull), new Pair <string, Action>("Run unit tests of LeMP", Benchmarks.LinqVsForLoop), new Pair <string, Action>("Hashtrees (InternalSet) vs HashSet/Dictionary", () => Benchmarks.BenchmarkSets(words)), new Pair <string, Action>("Thread-local storage", Benchmarks.ThreadLocalStorage), new Pair <string, Action>("IEnumerator<T> vs Iterator<T>", Benchmarks.EnumeratorVsIterator), new Pair <string, Action>("GoInterface", GoInterfaceBenchmark.DoBenchmark), new Pair <string, Action>("CPTrie (strings)", () => CPTrieBenchmark.BenchmarkStrings(words)), new Pair <string, Action>("CPTrie (integers)", CPTrieBenchmark.BenchmarkInts), new Pair <string, Action>("Byte array access", Benchmarks.ByteArrayAccess), new Pair <string, Action>("AList benchmarks (with chart Form)", () => new ListBenchmarks { TestDLists = false, TestOther = false }.Run(EzChartForm.StartOnNewThread(true))), new Pair <string, Action>("All collection benchmarks (with chart Form)", () => new ListBenchmarks().Run(EzChartForm.StartOnNewThread(true))), }); }
public static EzChartForm StartOnNewThread(bool example = false) { EzChartForm form = new EzChartForm(example); Thread thread = new Thread(() => System.Windows.Forms.Application.Run(form)); thread.SetApartmentState(ApartmentState.STA); // required by SaveFileDialog thread.Start(); return(form); }
public void Run(EzChartForm graph = null, Predicate <EzDataPoint> where = null) { Benchmarker b = new Benchmarker(1); _graph = graph; _where = null; #if !DotNet35 graph.InitDefaultModel = (id, model) => { model.LegendPosition = LegendPosition.TopLeft; model.PlotMargins = new OxyThickness(double.NaN, double.NaN, 12, double.NaN); // avoid cutting off "1000000" (NaN=autodetect) model.Axes.Add(new LogarithmicAxis { Position = AxisPosition.Bottom, Title = "List size", MajorGridlineStyle = LineStyle.Solid, MinorGridlineStyle = LineStyle.Dot }); int X = id.ToString().StartsWith("Scan by") ? StdIterations * 100 : StdIterations; model.Axes.Add(new LinearAxis { Position = AxisPosition.Left, Title = string.Format("Milliseconds to perform {0:n0} iterations", X), MajorGridlineStyle = LineStyle.Solid, MinorGridlineStyle = LineStyle.Dot, Minimum = -1, }); }; #endif Run(b, 30); Run(b, 100); Run(b, 300); Run(b, 1000); Run(b, 3000); Run(b, 10000); Run(b, 30000); Run(b, 100000); Run(b, 300000); Run(b, 1000000); //Run(b, 3000000); }
private static void RunBenchmarks() { new ListBenchmarks().Run(EzChartForm.StartOnNewThread(true)); Benchmarks.ConvexHull(); // Obtain the word list string wordList = Benchmark.Resources.Resources.WordList; string[] words = wordList.Split(new string[] { "\n", "\r\n" }, StringSplitOptions.RemoveEmptyEntries); Benchmarks.LinqVsForLoop(); //Benchmarks.CountOnes(); Benchmarks.BenchmarkSets(words); Benchmarks.ThreadLocalStorage(); Benchmarks.EnumeratorVsIterator(); GoInterfaceBenchmark.DoBenchmark(); CPTrieBenchmark.BenchmarkStrings(words); CPTrieBenchmark.BenchmarkInts(); Benchmarks.ByteArrayAccess(); }
public void Run(EzChartForm graph = null, Predicate <EzDataPoint> where = null) { Benchmarker b = new Benchmarker(1); _graph = graph; _where = null; graph.InitDefaultModel = (id, plotModel) => { plotModel.LegendPosition = LegendPosition.TopLeft; plotModel.PlotMargins = new OxyThickness(double.NaN, double.NaN, 12, double.NaN); // avoid cutting off "1000000" (NaN=autodetect) if (_graphConfiguration.TryGetValue(id, out var action)) { action(plotModel); } else { AddStandardAxes(plotModel, string.Format("Milliseconds to perform {0:n0} iterations", StdIterations), yMinimum: 0); } }; _r = new Random(_seed); RunListSizeBenchmarks(_graph, "Bytes used per list item", "Bytes used per 8-byte item", true); RunListSizeBenchmarks(_graph, "Bytes used per list", "Total heap bytes", false); RunDictionarySizeBenchmarks(_graph, "Bytes per dictionary pair", "Bytes used per 16-byte item", true); RunDictionarySizeBenchmarks(_graph, "Bytes per dictionary", "Total heap bytes", false); Run(b, 30); Run(b, 100); Run(b, 300); Run(b, 1000); Run(b, 3000); Run(b, 10000); Run(b, 30000); Run(b, 100000); Run(b, 300000); Run(b, 1000000); //Run(b, 3000000); }