forked from tsai/mathnet-numerics
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
1.3 KiB
31 lines
1.3 KiB
using System.Linq;
|
|
using Binarysharp.Benchmark;
|
|
using ConsoleDump;
|
|
|
|
namespace Performance
|
|
{
|
|
public class Program
|
|
{
|
|
public static void Main()
|
|
{
|
|
Run(new LinearAlgebra.DenseVectorAdd(10000000), 10, "Large (10'000'000)");
|
|
Run(new LinearAlgebra.DenseVectorAdd(100), 10000, "Small (100)");
|
|
}
|
|
|
|
static void Run<T>(uint iterations, string suffix = null) where T:new()
|
|
{
|
|
var bench = new BenchShark();
|
|
var result = bench.EvaluateDecoratedTasks<T>(iterations);
|
|
var label = string.IsNullOrEmpty(suffix) ? typeof (T).FullName : string.Concat(typeof (T).FullName, ": ", suffix);
|
|
result.FastestEvaluations.Select(x => new { x.Name, x.BestExecutionTime, x.AverageExecutionTime, x.WorstExecutionTime }).Dump(label);
|
|
}
|
|
|
|
static void Run(object obj, uint iterations, string suffix = null)
|
|
{
|
|
var bench = new BenchShark();
|
|
var result = bench.EvaluateDecoratedTasks(obj, iterations);
|
|
var label = string.IsNullOrEmpty(suffix) ? obj.GetType().FullName : string.Concat(obj.GetType().FullName, ": ", suffix);
|
|
result.FastestEvaluations.Select(x => new { x.Name, x.BestExecutionTime, x.AverageExecutionTime, x.WorstExecutionTime }).Dump(label);
|
|
}
|
|
}
|
|
}
|
|
|