Reorganized benchmarks
For cleaner project structure - inherited projects like in tests. Various other cleanup modifications, but no functional changes.
This commit is contained in:
Родитель
6f6b488c43
Коммит
057d15e7bf
16
EFCore.sln
16
EFCore.sln
|
@ -131,7 +131,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EFCore.SqlServer.Benchmarks
|
||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EFCore.Sqlite.Benchmarks", "benchmark\EFCore.Sqlite.Benchmarks\EFCore.Sqlite.Benchmarks.csproj", "{5A44F67E-517F-458D-B9C7-12A4DBBAD64A}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EFCore.Sqlite.Benchmarks", "benchmark\EFCore.Sqlite.Benchmarks\EFCore.Sqlite.Benchmarks.csproj", "{5A44F67E-517F-458D-B9C7-12A4DBBAD64A}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EFCore.Benchmarks.SqlServer.EF6", "benchmark\EFCore.SqlServer.EF6.Benchmarks\EFCore.Benchmarks.SqlServer.EF6.csproj", "{678AB38D-B27C-4690-A3F9-2D2488391658}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EF6.SqlServer.Benchmarks", "benchmark\EF6.SqlServer.Benchmarks\EF6.SqlServer.Benchmarks.csproj", "{678AB38D-B27C-4690-A3F9-2D2488391658}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EFCore.Benchmarks", "benchmark\EFCore.Benchmarks\EFCore.Benchmarks.csproj", "{2642F4F0-69BE-4C43-94B7-B298FEC87D89}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EF.Benchmarks.Shared", "benchmark\EF.Benchmarks.Shared\EF.Benchmarks.Shared.csproj", "{BFC26566-4C6D-4904-A559-8FFE09369901}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
@ -355,6 +359,14 @@ Global
|
||||||
{678AB38D-B27C-4690-A3F9-2D2488391658}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{678AB38D-B27C-4690-A3F9-2D2488391658}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{678AB38D-B27C-4690-A3F9-2D2488391658}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{678AB38D-B27C-4690-A3F9-2D2488391658}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{678AB38D-B27C-4690-A3F9-2D2488391658}.Release|Any CPU.Build.0 = Release|Any CPU
|
{678AB38D-B27C-4690-A3F9-2D2488391658}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{2642F4F0-69BE-4C43-94B7-B298FEC87D89}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{2642F4F0-69BE-4C43-94B7-B298FEC87D89}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{2642F4F0-69BE-4C43-94B7-B298FEC87D89}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{2642F4F0-69BE-4C43-94B7-B298FEC87D89}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{BFC26566-4C6D-4904-A559-8FFE09369901}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{BFC26566-4C6D-4904-A559-8FFE09369901}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{BFC26566-4C6D-4904-A559-8FFE09369901}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{BFC26566-4C6D-4904-A559-8FFE09369901}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
@ -414,6 +426,8 @@ Global
|
||||||
{24D7B6D5-A22A-4734-BB55-F464C112F891} = {293B4F79-3CB9-402A-A74C-B8108C41A7CF}
|
{24D7B6D5-A22A-4734-BB55-F464C112F891} = {293B4F79-3CB9-402A-A74C-B8108C41A7CF}
|
||||||
{5A44F67E-517F-458D-B9C7-12A4DBBAD64A} = {293B4F79-3CB9-402A-A74C-B8108C41A7CF}
|
{5A44F67E-517F-458D-B9C7-12A4DBBAD64A} = {293B4F79-3CB9-402A-A74C-B8108C41A7CF}
|
||||||
{678AB38D-B27C-4690-A3F9-2D2488391658} = {293B4F79-3CB9-402A-A74C-B8108C41A7CF}
|
{678AB38D-B27C-4690-A3F9-2D2488391658} = {293B4F79-3CB9-402A-A74C-B8108C41A7CF}
|
||||||
|
{2642F4F0-69BE-4C43-94B7-B298FEC87D89} = {293B4F79-3CB9-402A-A74C-B8108C41A7CF}
|
||||||
|
{BFC26566-4C6D-4904-A559-8FFE09369901} = {293B4F79-3CB9-402A-A74C-B8108C41A7CF}
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
SolutionGuid = {285A5EB4-BCF4-40EB-B9E1-DF6DBCB5E705}
|
SolutionGuid = {285A5EB4-BCF4-40EB-B9E1-DF6DBCB5E705}
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFrameworks>net461;netstandard2.0</TargetFrameworks>
|
||||||
|
<RootNamespace>Microsoft.EntityFrameworkCore.Benchmarks</RootNamespace>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<PropertyGroup Condition="$(Configuration.StartsWith('Release'))">
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
</Project>
|
|
@ -0,0 +1,54 @@
|
||||||
|
// Copyright (c) .NET Foundation. All rights reserved.
|
||||||
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Reflection;
|
||||||
|
using BenchmarkDotNet.Attributes;
|
||||||
|
using BenchmarkDotNet.Columns;
|
||||||
|
using BenchmarkDotNet.Configs;
|
||||||
|
using BenchmarkDotNet.Diagnosers;
|
||||||
|
using BenchmarkDotNet.Exporters;
|
||||||
|
using BenchmarkDotNet.Exporters.Csv;
|
||||||
|
using BenchmarkDotNet.Horology;
|
||||||
|
using BenchmarkDotNet.Reports;
|
||||||
|
using BenchmarkDotNet.Running;
|
||||||
|
|
||||||
|
namespace Microsoft.EntityFrameworkCore.Benchmarks
|
||||||
|
{
|
||||||
|
public static class EFCoreBenchmarkRunner
|
||||||
|
{
|
||||||
|
public static void Run(string[] args, Assembly assembly, IConfig config = null)
|
||||||
|
{
|
||||||
|
if (config == null)
|
||||||
|
{
|
||||||
|
config = DefaultConfig.Instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
config = config.With(DefaultConfig.Instance.GetDiagnosers().Concat(new[] { MemoryDiagnoser.Default }).ToArray());
|
||||||
|
|
||||||
|
var index = Array.FindIndex(args, s => s == "--perflab");
|
||||||
|
if (index >= 0)
|
||||||
|
{
|
||||||
|
var argList = args.ToList();
|
||||||
|
argList.RemoveAt(index);
|
||||||
|
args = argList.ToArray();
|
||||||
|
|
||||||
|
config = config
|
||||||
|
.With(StatisticColumn.OperationsPerSecond, new ParamsSummaryColumn())
|
||||||
|
.With(
|
||||||
|
MarkdownExporter.GitHub, new CsvExporter(
|
||||||
|
CsvSeparator.Comma,
|
||||||
|
new SummaryStyle
|
||||||
|
{
|
||||||
|
PrintUnitsInHeader = true,
|
||||||
|
PrintUnitsInContent = false,
|
||||||
|
TimeUnit = TimeUnit.Microsecond,
|
||||||
|
SizeUnit = SizeUnit.KB
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
BenchmarkSwitcher.FromAssembly(assembly).Run(args, config);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -18,7 +18,7 @@
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="..\Shared\**\*.cs" Link="%(RecursiveDir)%(FileName)%(Extension)" />
|
<ProjectReference Include="..\EF.Benchmarks.Shared\EF.Benchmarks.Shared.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
|
@ -1,11 +1,13 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// Copyright (c) .NET Foundation. All rights reserved.
|
||||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
using Microsoft.EntityFrameworkCore.Benchmarks;
|
||||||
|
|
||||||
namespace Microsoft.EntityFrameworkCore.Benchmarks.Models.AdventureWorks
|
namespace Microsoft.EntityFrameworkCore.Benchmarks.Models.AdventureWorks
|
||||||
{
|
{
|
||||||
public static class AdventureWorksFixture
|
public static class AdventureWorksFixture
|
||||||
{
|
{
|
||||||
public static string ConnectionString { get; } = $"{BenchmarkEnvironment.Instance.BenchmarkDatabase}Database=AdventureWorks2014;";
|
public static readonly string ConnectionString = SqlServerBenchmarkEnvironment.CreateConnectionString("AdventureWorks2014");
|
||||||
|
|
||||||
// This method is called from timed code, be careful when changing it
|
// This method is called from timed code, be careful when changing it
|
||||||
public static AdventureWorksContext CreateContext()
|
public static AdventureWorksContext CreateContext()
|
|
@ -19,7 +19,7 @@ namespace Microsoft.EntityFrameworkCore.Benchmarks.Models.Orders
|
||||||
public OrdersFixture(string databaseName, int productCount, int customerCount,
|
public OrdersFixture(string databaseName, int productCount, int customerCount,
|
||||||
int ordersPerCustomer, int linesPerOrder, Action<DbContext> seedAction = null)
|
int ordersPerCustomer, int linesPerOrder, Action<DbContext> seedAction = null)
|
||||||
{
|
{
|
||||||
_connectionString = $"{BenchmarkEnvironment.Instance.BenchmarkDatabase}Database={databaseName};";
|
_connectionString = SqlServerBenchmarkEnvironment.CreateConnectionString(databaseName);
|
||||||
_productCount = productCount;
|
_productCount = productCount;
|
||||||
_customerCount = customerCount;
|
_customerCount = customerCount;
|
||||||
_ordersPerCustomer = ordersPerCustomer;
|
_ordersPerCustomer = ordersPerCustomer;
|
|
@ -10,6 +10,7 @@ using System.Reflection;
|
||||||
|
|
||||||
// ReSharper disable PossibleNullReferenceException
|
// ReSharper disable PossibleNullReferenceException
|
||||||
|
|
||||||
|
// ReSharper disable once CheckNamespace
|
||||||
namespace Microsoft.EntityFrameworkCore.Benchmarks
|
namespace Microsoft.EntityFrameworkCore.Benchmarks
|
||||||
{
|
{
|
||||||
public static class Extensions
|
public static class Extensions
|
|
@ -0,0 +1,23 @@
|
||||||
|
// Copyright (c) .NET Foundation. All rights reserved.
|
||||||
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Linq;
|
||||||
|
using BenchmarkDotNet.Attributes;
|
||||||
|
using BenchmarkDotNet.Columns;
|
||||||
|
using BenchmarkDotNet.Configs;
|
||||||
|
using BenchmarkDotNet.Diagnosers;
|
||||||
|
using BenchmarkDotNet.Exporters;
|
||||||
|
using BenchmarkDotNet.Exporters.Csv;
|
||||||
|
using BenchmarkDotNet.Horology;
|
||||||
|
using BenchmarkDotNet.Reports;
|
||||||
|
using BenchmarkDotNet.Running;
|
||||||
|
|
||||||
|
// ReSharper disable once CheckNamespace
|
||||||
|
namespace Microsoft.EntityFrameworkCore.Benchmarks
|
||||||
|
{
|
||||||
|
public class Program
|
||||||
|
{
|
||||||
|
private static void Main(string[] args) => EFCoreBenchmarkRunner.Run(args, typeof(Program).Assembly);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,34 @@
|
||||||
|
// Copyright (c) .NET Foundation. All rights reserved.
|
||||||
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
using System.IO;
|
||||||
|
using System.Data.SqlClient;
|
||||||
|
using Microsoft.Extensions.Configuration;
|
||||||
|
|
||||||
|
// ReSharper disable once CheckNamespace
|
||||||
|
namespace Microsoft.EntityFrameworkCore.Benchmarks
|
||||||
|
{
|
||||||
|
public static class SqlServerBenchmarkEnvironment
|
||||||
|
{
|
||||||
|
public static IConfiguration Config { get; }
|
||||||
|
|
||||||
|
static SqlServerBenchmarkEnvironment()
|
||||||
|
{
|
||||||
|
var configBuilder = new ConfigurationBuilder()
|
||||||
|
.SetBasePath(Directory.GetCurrentDirectory())
|
||||||
|
.AddJsonFile("config.json", optional: true)
|
||||||
|
.AddEnvironmentVariables();
|
||||||
|
|
||||||
|
Config = configBuilder.Build()
|
||||||
|
.GetSection("Test:SqlServer");
|
||||||
|
}
|
||||||
|
|
||||||
|
private const string DefaultConnectionString
|
||||||
|
= "Data Source=(localdb)\\MSSQLLocalDB;Database=master;Integrated Security=True;Connect Timeout=30;ConnectRetryCount=0";
|
||||||
|
|
||||||
|
public static string DefaultConnection => Config["DefaultConnection"] ?? DefaultConnectionString;
|
||||||
|
|
||||||
|
public static string CreateConnectionString(string name, string fileName = null, bool? multipleActiveResultSets = null)
|
||||||
|
=> new SqlConnectionStringBuilder(DefaultConnection) { InitialCatalog = name }.ToString();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"benchmarks": {
|
||||||
|
"benchmarkDatabase": "Server=(localdb)\\mssqllocaldb;Trusted_Connection=True;MultipleActiveResultSets=true;"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,37 @@
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFrameworks>net461;netcoreapp2.0;netcoreapp2.1;netcoreapp2.2;netcoreapp3.0</TargetFrameworks>
|
||||||
|
<TargetFrameworks Condition=" '$(Configuration)' == 'Release' Or '$(Configuration)' == 'Debug' ">netcoreapp3.0</TargetFrameworks>
|
||||||
|
<RootNamespace>Microsoft.EntityFrameworkCore.Benchmarks</RootNamespace>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<PropertyGroup Condition="$(Configuration.StartsWith('Release'))">
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\EF.Benchmarks.Shared\EF.Benchmarks.Shared.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup Condition=" '$(Configuration)' == 'Release' Or '$(Configuration)' == 'Debug' ">
|
||||||
|
<ProjectReference Include="..\..\src\EFCore.Relational\EFCore.Relational.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup Condition=" '$(Configuration)' == 'Release22' Or '$(Configuration)' == 'Debug22' ">
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="2.2.4" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup Condition=" '$(Configuration)' == 'Release21' Or '$(Configuration)' == 'Debug21' ">
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="2.1.11" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup Condition=" '$(Configuration)' == 'Release20' Or '$(Configuration)' == 'Debug20' ">
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="2.0.3" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)' == 'Release22' Or '$(Configuration)' == 'Release21' Or '$(Configuration)' == 'Release20' Or '$(Configuration)' == 'Debug22' Or '$(Configuration)' == 'Debug21' Or '$(Configuration)' == 'Debug20'">
|
||||||
|
<DefineConstants>$(DefineConstants);OLD_FROM_SQL</DefineConstants>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
</Project>
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче