-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Commit
More cleanup to do (removing Type column next), but getting to some very usable output now.
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,27 @@ | ||
using BenchmarkDotNet.Attributes; | ||
using BenchmarkDotNet.Attributes.Columns; | ||
using BenchmarkDotNet.Columns; | ||
using BenchmarkDotNet.Configs; | ||
using BenchmarkDotNet.Diagnosers; | ||
using BenchmarkDotNet.Horology; | ||
using BenchmarkDotNet.Jobs; | ||
using BenchmarkDotNet.Order; | ||
using Dapper.Tests.Performance.Helpers; | ||
using System; | ||
using System.Configuration; | ||
using System.Data.SqlClient; | ||
|
||
namespace Dapper.Tests.Performance | ||
{ | ||
[OrderProvider(SummaryOrderPolicy.FastestToSlowest)] | ||
[RankColumn] | ||
[Config(typeof(Config))] | ||
public abstract class BenchmarkBase | ||
{ | ||
public const int Iterations = 50; | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
NickCraver
Member
|
||
protected static readonly Random _rand = new Random(); | ||
protected SqlConnection _connection; | ||
public static string ConnectionString { get; } = ConfigurationManager.ConnectionStrings["Main"].ConnectionString; | ||
|
||
protected int i; | ||
|
||
protected void BaseSetup() | ||
|
@@ -36,6 +43,14 @@ public class Config : ManualConfig | |
public Config() | ||
{ | ||
Add(new MemoryDiagnoser()); | ||
Add(new ORMColum()); | ||
Add(new ReturnColum()); | ||
Add(Job.Default | ||
.WithLaunchCount(1) | ||
.WithIterationTime(new TimeInterval(500, TimeUnit.Millisecond)) | ||
.WithWarmupCount(3) | ||
.WithTargetCount(3) | ||
); | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
using BenchmarkDotNet.Columns; | ||
using BenchmarkDotNet.Reports; | ||
using BenchmarkDotNet.Running; | ||
|
||
namespace Dapper.Tests.Performance.Helpers | ||
{ | ||
public class ORMColum : IColumn | ||
{ | ||
public string Id => nameof(ORMColum); | ||
public string ColumnName { get; } = "ORM"; | ||
public string Legend => "The object relational mapper being tested"; | ||
|
||
public bool IsDefault(Summary summary, Benchmark benchmark) => false; | ||
public string GetValue(Summary summary, Benchmark benchmark) => benchmark.Target.Method.DeclaringType.Name.Replace("Benchmarks", string.Empty); | ||
public string GetValue(Summary summary, Benchmark benchmark, ISummaryStyle style) => benchmark.Target.Method.DeclaringType.Name.Replace("Benchmarks", string.Empty); | ||
|
||
public bool IsAvailable(Summary summary) => true; | ||
public bool AlwaysShow => true; | ||
public ColumnCategory Category => ColumnCategory.Job; | ||
public int PriorityInCategory => -10; | ||
public bool IsNumeric => false; | ||
public UnitType UnitType => UnitType.Dimensionless; | ||
public override string ToString() => ColumnName; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
using BenchmarkDotNet.Columns; | ||
using BenchmarkDotNet.Reports; | ||
using BenchmarkDotNet.Running; | ||
|
||
namespace Dapper.Tests.Performance.Helpers | ||
{ | ||
public class ReturnColum : IColumn | ||
{ | ||
public string Id => nameof(ReturnColum); | ||
public string ColumnName { get; } = "Return"; | ||
public string Legend => "The return type of the method"; | ||
|
||
public bool IsDefault(Summary summary, Benchmark benchmark) => false; | ||
public string GetValue(Summary summary, Benchmark benchmark) => benchmark.Target.Method.ReturnType.Name; | ||
public string GetValue(Summary summary, Benchmark benchmark, ISummaryStyle style) => benchmark.Target.Method.ReturnType.Name; | ||
|
||
public bool IsAvailable(Summary summary) => true; | ||
public bool AlwaysShow => true; | ||
public ColumnCategory Category => ColumnCategory.Job; | ||
public int PriorityInCategory => 1; | ||
public bool IsNumeric => false; | ||
public UnitType UnitType => UnitType.Dimensionless; | ||
public override string ToString() => ColumnName; | ||
} | ||
} |
I might be missing something, but it is used in
OperationsPerInvoke
only while most (all?) benchmarks have a single operation inside. Is it intentional or just a mistake?