Commit b262cb33 authored by markjerz's avatar markjerz Committed by Nick Craver

Added Dashing Benchmarks (#1126)

Adds Dashing benchmarks to Dapper.Tests.Performance
parent 5256f2ea
using BenchmarkDotNet.Attributes;
using Dapper.Tests.Performance.Dashing;
using Dashing;
namespace Dapper.Tests.Performance
{
public class DashingBenchmarks : BenchmarkBase
{
private ISession session;
[GlobalSetup]
public void Setup()
{
BaseSetup();
var configuration = new DashingConfiguration();
var database = new SqlDatabase(configuration, ConnectionString);
this.session = database.BeginTransactionLessSession(_connection);
}
[Benchmark(Description = "Get By Id")]
public Dashing.Post QueryBuffered()
{
Step();
return session.Get<Dashing.Post>(i);
}
}
}
<Project Sdk="Microsoft.NET.Sdk">
<Project>
<Import Sdk="Microsoft.NET.Sdk" Project="Sdk.props" />
<PropertyGroup>
<AssemblyName>Dapper.Tests.Performance</AssemblyName>
<Title>Dapper.Tests.Performance</Title>
......@@ -11,6 +12,8 @@
<ProjectReference Include="..\Dapper\Dapper.csproj" />
<ProjectReference Include="..\Dapper.Contrib\Dapper.Contrib.csproj" />
<ProjectReference Include="..\Dapper.EntityFramework\Dapper.EntityFramework.csproj" />
<PackageReference Include="Dashing" Version="2.0.7" />
<PackageReference Include="Dashing.Weaver" Version="2.0.7" />
<PackageReference Include="Belgrade.Sql.Client" Version="1.1.4" />
<PackageReference Include="BenchmarkDotNet" Version="0.11.1" />
<!--<PackageReference Include="BLToolkit" Version="4.3.6" />-->
......@@ -45,4 +48,8 @@
<ItemGroup>
<PackageReference Update="SourceLink.Create.GitHub" Version="2.8.3" />
</ItemGroup>
<Import Sdk="Microsoft.NET.Sdk" Project="Sdk.targets" />
<PropertyGroup>
<WeaveArguments>-p "$(MSBuildThisFileDirectory)$(OutputPath)$(AssemblyName).exe" -t "Dapper.Tests.Performance.Dashing.DashingConfiguration"</WeaveArguments>
</PropertyGroup>
</Project>
using Dashing.Configuration;
namespace Dapper.Tests.Performance.Dashing
{
public class DashingConfiguration : BaseConfiguration
{
public DashingConfiguration()
{
this.Add<Post>();
}
}
}
\ No newline at end of file
using System;
namespace Dapper.Tests.Performance.Dashing
{
public class Post
{
public int Id { get; set; }
public string Text { get; set; }
public DateTime CreationDate { get; set; }
public DateTime LastChangeDate { get; set; }
public int? Counter1 { get; set; }
public int? Counter2 { get; set; }
public int? Counter3 { get; set; }
public int? Counter4 { get; set; }
public int? Counter5 { get; set; }
public int? Counter6 { get; set; }
public int? Counter7 { get; set; }
public int? Counter8 { get; set; }
public int? Counter9 { get; set; }
}
}
......@@ -19,7 +19,9 @@
using Susanoo;
using System.Configuration;
using System.Threading.Tasks;
using Dapper.Tests.Performance.Dashing;
using Dapper.Tests.Performance.EntityFrameworkCore;
using Dashing;
using Microsoft.EntityFrameworkCore;
using Belgrade.SqlClient;
......@@ -186,6 +188,15 @@ public async Task RunAsync(int iterations)
tests.Add(id => mapperConnection3.Get<Post>(id), "Dapper.Contrib");
}, "Dapper");
// Dashing
Try(() =>
{
var config = new DashingConfiguration();
var database = new SqlDatabase(config, ConnectionString);
var session = database.BeginTransactionLessSession(GetOpenConnection());
tests.Add(id => session.Get<Dashing.Post>(id), "Dashing Get");
}, "Dashing");
// Massive
Try(() =>
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment