Files
Dapper/Dapper.Tests.Performance/Benchmarks.cs
T
Nick Craver 0b168789fd Benchmarks: updating libs and overall runner (#1123)
This is prepping a run we can drop into the README easily. And more info on allocations and such along with it. It's finishing off the benchmark port getting it into a good output state (something we can copy/paste). It removes Simple.Data because the package was debug and causes a lot of issues.

This doesn't output 100% like we want yet (fastest to slowest). BenchmarkDotNet joins summary results after ordering...we need to post-order that. I'm asking the maintainers how to do so.

Also note Belgrade was not parameterizing before, giving it a huge unfair advantage. This has been fixed to be apples:apples.
2018-09-10 20:22:10 -04:00

32 lines
868 B
C#

using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Order;
using System;
using System.Configuration;
using System.Data.SqlClient;
namespace Dapper.Tests.Performance
{
[Orderer(SummaryOrderPolicy.FastestToSlowest)]
[BenchmarkCategory("ORM")]
public abstract class BenchmarkBase
{
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()
{
i = 0;
_connection = new SqlConnection(ConnectionString);
_connection.Open();
}
protected void Step()
{
i++;
if (i > 5000) i = 1;
}
}
}