Skip to content

Commit

Permalink
Merge pull request #217 from psibernetic/SusanooBenchmarks
Browse files Browse the repository at this point in the history
Adding Susanoo benchmarks
  • Loading branch information
mgravell committed Mar 18, 2015
2 parents 2f4119f + 483d393 commit 9ab09f9
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 4 deletions.
7 changes: 5 additions & 2 deletions Dapper.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.22013.1
# Visual Studio 2013
VisualStudioVersion = 12.0.31101.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DapperTests NET40", "Tests\DapperTests NET40.csproj", "{A2A80512-11F4-4028-A995-505463632C84}"
EndProject
Expand Down Expand Up @@ -273,4 +273,7 @@ Global
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(Performance) = preSolution
HasPerformanceSessions = true
EndGlobalSection
EndGlobal
4 changes: 4 additions & 0 deletions Tests/DapperTests NET40.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,10 @@
<Reference Include="SubSonic.Core">
<HintPath>SubSonic\SubSonic.Core.dll</HintPath>
</Reference>
<Reference Include="Susanoo.Core, Version=0.5.3.0, Culture=neutral, PublicKeyToken=0a505ce04f8a59d5, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Susanoo.Core.0.5.3.0\lib\net45\Susanoo.Core.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.configuration" />
Expand Down
39 changes: 37 additions & 2 deletions Tests/PerformanceTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
using SqlMapper.NHibernate;
using Dapper.Contrib.Extensions;
using SqlMapper.EntityFramework;
using Susanoo;

namespace SqlMapper
{
Expand Down Expand Up @@ -137,15 +138,15 @@ public void Run(int iterations)
// PetaPoco test with all default options
var petapoco = new PetaPoco.Database(Program.ConnectionString, "System.Data.SqlClient");
petapoco.OpenSharedConnection();
tests.Add(id => petapoco.Fetch<Post>("SELECT * from Posts where Id=@0", id), "PetaPoco (Normal)");
tests.Add(id => petapoco.Fetch<Post>("SELECT * from Posts where Id=@0", id).First(), "PetaPoco (Normal)");

// PetaPoco with some "smart" functionality disabled
var petapocoFast = new PetaPoco.Database(Program.ConnectionString, "System.Data.SqlClient");
petapocoFast.OpenSharedConnection();
petapocoFast.EnableAutoSelect = false;
petapocoFast.EnableNamedParams = false;
petapocoFast.ForceDateTimesToUtc = false;
tests.Add(id => petapocoFast.Fetch<Post>("SELECT * from Posts where Id=@0", id), "PetaPoco (Fast)");
tests.Add(id => petapocoFast.Fetch<Post>("SELECT * from Posts where Id=@0", id).First(), "PetaPoco (Fast)");

// Subsonic ActiveRecord
tests.Add(id => SubSonic.Post.SingleOrDefault(x => x.Id == id), "SubSonic ActiveRecord.SingleOrDefault");
Expand Down Expand Up @@ -187,6 +188,40 @@ public void Run(int iterations)
var sdb = Simple.Data.Database.OpenConnection(Program.ConnectionString);
tests.Add(id => sdb.Posts.FindById(id), "Simple.Data");

//Susanoo
var susanooDb = new DatabaseManager("Smackdown.Properties.Settings.tempdbConnectionString");
var susanooDb2 = new DatabaseManager("Smackdown.Properties.Settings.tempdbConnectionString");

var susanooPreDefinedCommand =
CommandManager.DefineCommand("SELECT * FROM Posts WHERE Id = @Id", CommandType.Text)
.DefineResults<Post>()
.Realize("PostById");

var susanooDynamicPreDefinedCommand =
CommandManager.DefineCommand("SELECT * FROM Posts WHERE Id = @Id", CommandType.Text)
.DefineResults<dynamic>()
.Realize("DynamicById");

tests.Add(Id =>
CommandManager.DefineCommand("SELECT * FROM Posts WHERE Id = @Id", CommandType.Text)
.DefineResults<Post>()
.Realize("PostById")
.Execute(susanooDb, new { Id }).First(), "Susanoo Mapping Cache Retrieval");

tests.Add(Id =>
CommandManager.DefineCommand("SELECT * FROM Posts WHERE Id = @Id", CommandType.Text)
.DefineResults<dynamic>()
.Realize("DynamicById")
.Execute(susanooDb, new { Id }).First(), "Susanoo Dynamic Mapping Cache Retrieval");

tests.Add(Id =>
susanooDynamicPreDefinedCommand
.Execute(susanooDb, new { Id }).First(), "Susanoo Dynamic Mapping Static");

tests.Add(Id =>
susanooPreDefinedCommand
.Execute(susanooDb, new { Id }).First(), "Susanoo Mapping Static");

// Soma
var somadb = new Soma.Core.Db(new SomaConfig());
tests.Add(id => somadb.Find<Post>(id), "Soma");
Expand Down
1 change: 1 addition & 0 deletions Tests/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@
<package id="Microsoft.SqlServer.Types" version="11.0.1" targetFramework="net45" />
<package id="Npgsql" version="2.2.1" targetFramework="net45" />
<package id="SqlServerCompact" version="4.0.8854.1" targetFramework="net45" />
<package id="Susanoo.Core" version="0.5.3.0" targetFramework="net45" />
</packages>

0 comments on commit 9ab09f9

Please sign in to comment.