Skip to content

Commit

Permalink
Merge branch 'master' into fix-settings-concurrency
Browse files Browse the repository at this point in the history
# Conflicts:
#	src/Mapster/Settings/SettingStore.cs
  • Loading branch information
Chaowlert committed Jul 25, 2020
2 parents 7d96d00 + 912f45b commit f96a9e7
Show file tree
Hide file tree
Showing 19 changed files with 140 additions and 150 deletions.
6 changes: 3 additions & 3 deletions src/Benchmark/Benchmark.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.0</TargetFramework>
<TargetFramework>netcoreapp3.1</TargetFramework>
<CopyLocalLockFileAssemblies Condition=" '$(Configuration)'=='Debug' ">true</CopyLocalLockFileAssemblies>
<DefaultItemExcludes>**/*.g.cs</DefaultItemExcludes>
</PropertyGroup>
Expand All @@ -19,10 +19,10 @@
</Compile>
</ItemGroup>
<ItemGroup>
<PackageReference Include="BenchmarkDotNet" Version="0.12.0" />
<PackageReference Include="BenchmarkDotNet" Version="0.12.1" />
<PackageReference Include="ExpressionDebugger" Version="2.1.2" />
<PackageReference Include="ExpressionTranslator" Version="2.1.0" />
<PackageReference Include="AutoMapper" Version="9.0.0" />
<PackageReference Include="AutoMapper" Version="10.0.0" />
<PackageReference Include="Expressmapper" Version="1.9.1" />
<PackageReference Include="FastExpressionCompiler" Version="2.0.0" />
</ItemGroup>
Expand Down
24 changes: 12 additions & 12 deletions src/Benchmark/Benchmarks/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,23 @@ public class Config : ManualConfig
{
public Config()
{
Add(ConsoleLogger.Default);
AddLogger(ConsoleLogger.Default);

Add(CsvExporter.Default);
Add(MarkdownExporter.GitHub);
Add(HtmlExporter.Default);
AddExporter(CsvExporter.Default);
AddExporter(MarkdownExporter.GitHub);
AddExporter(HtmlExporter.Default);

Add(MemoryDiagnoser.Default);
Add(TargetMethodColumn.Method);
AddDiagnoser(MemoryDiagnoser.Default);
AddColumn(TargetMethodColumn.Method);

Add(StatisticColumn.Mean);
Add(StatisticColumn.StdDev);
Add(StatisticColumn.Error);
AddColumn(StatisticColumn.Mean);
AddColumn(StatisticColumn.StdDev);
AddColumn(StatisticColumn.Error);

Add(BaselineRatioColumn.RatioMean);
Add(DefaultColumnProviders.Metrics);
AddColumn(BaselineRatioColumn.RatioMean);
AddColumnProvider(DefaultColumnProviders.Metrics);

Add(Job.ShortRun
AddJob(Job.ShortRun
.WithLaunchCount(1)
.WithWarmupCount(2)
.WithIterationCount(10)
Expand Down
78 changes: 39 additions & 39 deletions src/Benchmark/Benchmarks/TestAll.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,106 +5,106 @@ namespace Benchmark.Benchmarks
{
public class TestAll
{
private Foo fooInstance;
private Customer customerInstance;
private Foo _fooInstance;
private Customer _customerInstance;

[Params(100_000)]//, 1_000_000)]
public int Iterations { get; set; }

[Benchmark(Description = "Mapster 5.0.0")]
public void MapsterTest()
{
TestAdaptHelper.TestMapsterAdapter<Foo, Foo>(fooInstance, Iterations);
TestAdaptHelper.TestMapsterAdapter<Customer, CustomerDTO>(customerInstance, Iterations);
TestAdaptHelper.TestMapsterAdapter<Foo, Foo>(_fooInstance, Iterations);
TestAdaptHelper.TestMapsterAdapter<Customer, CustomerDTO>(_customerInstance, Iterations);
}

[Benchmark(Description = "Mapster 5.0.0 (Roslyn)")]
public void RoslynTest()
{
TestAdaptHelper.TestMapsterAdapter<Foo, Foo>(fooInstance, Iterations);
TestAdaptHelper.TestMapsterAdapter<Customer, CustomerDTO>(customerInstance, Iterations);
TestAdaptHelper.TestMapsterAdapter<Foo, Foo>(_fooInstance, Iterations);
TestAdaptHelper.TestMapsterAdapter<Customer, CustomerDTO>(_customerInstance, Iterations);
}

[Benchmark(Description = "Mapster 5.0.0 (FEC)")]
public void FecTest()
{
TestAdaptHelper.TestMapsterAdapter<Foo, Foo>(fooInstance, Iterations);
TestAdaptHelper.TestMapsterAdapter<Customer, CustomerDTO>(customerInstance, Iterations);
TestAdaptHelper.TestMapsterAdapter<Foo, Foo>(_fooInstance, Iterations);
TestAdaptHelper.TestMapsterAdapter<Customer, CustomerDTO>(_customerInstance, Iterations);
}

[Benchmark(Description = "Mapster 5.0.0 (Codegen)")]
public void CodegenTest()
{
TestAdaptHelper.TestCodeGen(fooInstance, Iterations);
TestAdaptHelper.TestCodeGen(customerInstance, Iterations);
TestAdaptHelper.TestCodeGen(_fooInstance, Iterations);
TestAdaptHelper.TestCodeGen(_customerInstance, Iterations);
}

[Benchmark(Description = "ExpressMapper 1.9.1")]
public void ExpressMapperTest()
{
TestAdaptHelper.TestExpressMapper<Foo, Foo>(fooInstance, Iterations);
TestAdaptHelper.TestExpressMapper<Customer, CustomerDTO>(customerInstance, Iterations);
TestAdaptHelper.TestExpressMapper<Foo, Foo>(_fooInstance, Iterations);
TestAdaptHelper.TestExpressMapper<Customer, CustomerDTO>(_customerInstance, Iterations);
}

[Benchmark(Description = "AutoMapper 9.0.0")]
[Benchmark(Description = "AutoMapper 10.0.0")]
public void AutoMapperTest()
{
TestAdaptHelper.TestAutoMapper<Foo, Foo>(fooInstance, Iterations);
TestAdaptHelper.TestAutoMapper<Customer, CustomerDTO>(customerInstance, Iterations);
TestAdaptHelper.TestAutoMapper<Foo, Foo>(_fooInstance, Iterations);
TestAdaptHelper.TestAutoMapper<Customer, CustomerDTO>(_customerInstance, Iterations);
}

[GlobalSetup(Target = nameof(MapsterTest))]
public void SetupMapster()
{
fooInstance = TestAdaptHelper.SetupFooInstance();
customerInstance = TestAdaptHelper.SetupCustomerInstance();
TestAdaptHelper.ConfigureMapster(fooInstance, MapsterCompilerType.Default);
TestAdaptHelper.ConfigureMapster(customerInstance, MapsterCompilerType.Default);
_fooInstance = TestAdaptHelper.SetupFooInstance();
_customerInstance = TestAdaptHelper.SetupCustomerInstance();
TestAdaptHelper.ConfigureMapster(_fooInstance, MapsterCompilerType.Default);
TestAdaptHelper.ConfigureMapster(_customerInstance, MapsterCompilerType.Default);
}

[GlobalSetup(Target = nameof(RoslynTest))]
public void SetupRoslyn()
{
fooInstance = TestAdaptHelper.SetupFooInstance();
customerInstance = TestAdaptHelper.SetupCustomerInstance();
TestAdaptHelper.ConfigureMapster(fooInstance, MapsterCompilerType.Roslyn);
TestAdaptHelper.ConfigureMapster(customerInstance, MapsterCompilerType.Roslyn);
_fooInstance = TestAdaptHelper.SetupFooInstance();
_customerInstance = TestAdaptHelper.SetupCustomerInstance();
TestAdaptHelper.ConfigureMapster(_fooInstance, MapsterCompilerType.Roslyn);
TestAdaptHelper.ConfigureMapster(_customerInstance, MapsterCompilerType.Roslyn);
}

[GlobalSetup(Target = nameof(FecTest))]
public void SetupFec()
{
fooInstance = TestAdaptHelper.SetupFooInstance();
customerInstance = TestAdaptHelper.SetupCustomerInstance();
TestAdaptHelper.ConfigureMapster(fooInstance, MapsterCompilerType.FEC);
TestAdaptHelper.ConfigureMapster(customerInstance, MapsterCompilerType.FEC);
_fooInstance = TestAdaptHelper.SetupFooInstance();
_customerInstance = TestAdaptHelper.SetupCustomerInstance();
TestAdaptHelper.ConfigureMapster(_fooInstance, MapsterCompilerType.FEC);
TestAdaptHelper.ConfigureMapster(_customerInstance, MapsterCompilerType.FEC);
}

[GlobalSetup(Target = nameof(CodegenTest))]
public void SetupCodegen()
{
fooInstance = TestAdaptHelper.SetupFooInstance();
customerInstance = TestAdaptHelper.SetupCustomerInstance();
FooMapper.Map(fooInstance);
CustomerMapper.Map(customerInstance);
_fooInstance = TestAdaptHelper.SetupFooInstance();
_customerInstance = TestAdaptHelper.SetupCustomerInstance();
FooMapper.Map(_fooInstance);
CustomerMapper.Map(_customerInstance);
}

[GlobalSetup(Target = nameof(ExpressMapperTest))]
public void SetupExpressMapper()
{
fooInstance = TestAdaptHelper.SetupFooInstance();
customerInstance = TestAdaptHelper.SetupCustomerInstance();
TestAdaptHelper.ConfigureExpressMapper(fooInstance);
TestAdaptHelper.ConfigureExpressMapper(customerInstance);
_fooInstance = TestAdaptHelper.SetupFooInstance();
_customerInstance = TestAdaptHelper.SetupCustomerInstance();
TestAdaptHelper.ConfigureExpressMapper(_fooInstance);
TestAdaptHelper.ConfigureExpressMapper(_customerInstance);
}

[GlobalSetup(Target = nameof(AutoMapperTest))]
public void SetupAutoMapper()
{
fooInstance = TestAdaptHelper.SetupFooInstance();
customerInstance = TestAdaptHelper.SetupCustomerInstance();
TestAdaptHelper.ConfigureAutoMapper(fooInstance);
TestAdaptHelper.ConfigureAutoMapper(customerInstance);
_fooInstance = TestAdaptHelper.SetupFooInstance();
_customerInstance = TestAdaptHelper.SetupCustomerInstance();
TestAdaptHelper.ConfigureAutoMapper(_fooInstance);
TestAdaptHelper.ConfigureAutoMapper(_customerInstance);
}

}
Expand Down
38 changes: 19 additions & 19 deletions src/Benchmark/Benchmarks/TestComplexTypes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,87 +5,87 @@ namespace Benchmark.Benchmarks
{
public class TestComplexTypes
{
private Customer customerInstance;
private Customer _customerInstance;

[Params(1000, 10_000, 100_000, 1_000_000)]
public int Iterations { get; set; }

[Benchmark]
public void MapsterTest()
{
TestAdaptHelper.TestMapsterAdapter<Customer, CustomerDTO>(customerInstance, Iterations);
TestAdaptHelper.TestMapsterAdapter<Customer, CustomerDTO>(_customerInstance, Iterations);
}

[Benchmark(Description = "Mapster 5.0.0 (Roslyn)")]
public void RoslynTest()
{
TestAdaptHelper.TestMapsterAdapter<Customer, CustomerDTO>(customerInstance, Iterations);
TestAdaptHelper.TestMapsterAdapter<Customer, CustomerDTO>(_customerInstance, Iterations);
}

[Benchmark(Description = "Mapster 5.0.0 (FEC)")]
public void FecTest()
{
TestAdaptHelper.TestMapsterAdapter<Customer, CustomerDTO>(customerInstance, Iterations);
TestAdaptHelper.TestMapsterAdapter<Customer, CustomerDTO>(_customerInstance, Iterations);
}

[Benchmark]
public void CodegenTest()
{
TestAdaptHelper.TestCodeGen(customerInstance, Iterations);
TestAdaptHelper.TestCodeGen(_customerInstance, Iterations);
}

[Benchmark]
public void ExpressMapperTest()
{
TestAdaptHelper.TestExpressMapper<Customer, CustomerDTO>(customerInstance, Iterations);
TestAdaptHelper.TestExpressMapper<Customer, CustomerDTO>(_customerInstance, Iterations);
}

[Benchmark]
public void AutoMapperTest()
{
TestAdaptHelper.TestAutoMapper<Customer, CustomerDTO>(customerInstance, Iterations);
TestAdaptHelper.TestAutoMapper<Customer, CustomerDTO>(_customerInstance, Iterations);
}

[GlobalSetup(Target = nameof(MapsterTest))]
public void SetupMapster()
{
customerInstance = TestAdaptHelper.SetupCustomerInstance();
TestAdaptHelper.ConfigureMapster(customerInstance, MapsterCompilerType.Default);
_customerInstance = TestAdaptHelper.SetupCustomerInstance();
TestAdaptHelper.ConfigureMapster(_customerInstance, MapsterCompilerType.Default);
}

[GlobalSetup(Target = nameof(RoslynTest))]
public void SetupRoslyn()
{
customerInstance = TestAdaptHelper.SetupCustomerInstance();
TestAdaptHelper.ConfigureMapster(customerInstance, MapsterCompilerType.Roslyn);
_customerInstance = TestAdaptHelper.SetupCustomerInstance();
TestAdaptHelper.ConfigureMapster(_customerInstance, MapsterCompilerType.Roslyn);
}

[GlobalSetup(Target = nameof(FecTest))]
public void SetupFec()
{
customerInstance = TestAdaptHelper.SetupCustomerInstance();
TestAdaptHelper.ConfigureMapster(customerInstance, MapsterCompilerType.FEC);
_customerInstance = TestAdaptHelper.SetupCustomerInstance();
TestAdaptHelper.ConfigureMapster(_customerInstance, MapsterCompilerType.FEC);
}

[GlobalSetup(Target = nameof(CodegenTest))]
public void SetupCodegen()
{
customerInstance = TestAdaptHelper.SetupCustomerInstance();
CustomerMapper.Map(customerInstance);
_customerInstance = TestAdaptHelper.SetupCustomerInstance();
CustomerMapper.Map(_customerInstance);
}

[GlobalSetup(Target = nameof(ExpressMapperTest))]
public void SetupExpressMapper()
{
customerInstance = TestAdaptHelper.SetupCustomerInstance();
TestAdaptHelper.ConfigureExpressMapper(customerInstance);
_customerInstance = TestAdaptHelper.SetupCustomerInstance();
TestAdaptHelper.ConfigureExpressMapper(_customerInstance);
}

[GlobalSetup(Target = nameof(AutoMapperTest))]
public void SetupAutoMapper()
{
customerInstance = TestAdaptHelper.SetupCustomerInstance();
TestAdaptHelper.ConfigureAutoMapper(customerInstance);
_customerInstance = TestAdaptHelper.SetupCustomerInstance();
TestAdaptHelper.ConfigureAutoMapper(_customerInstance);
}
}
}
Loading

0 comments on commit f96a9e7

Please sign in to comment.