mirror of
https://github.com/DapperLib/Dapper.git
synced 2026-10-18 14:27:47 +08:00
0b168789fd
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.
32 lines
868 B
C#
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;
|
|
}
|
|
}
|
|
}
|