Skip to content

Commit e920394

Browse files
committed
fix benchmark config
1 parent 047bc78 commit e920394

7 files changed

Lines changed: 29 additions & 271 deletions

File tree

‎src/Benchmark.Development/Benchmark.Development.csproj‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,15 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net9.0</TargetFramework>
5+
<TargetFramework>net10.0</TargetFramework>
66
<CopyLocalLockFileAssemblies Condition=" '$(Configuration)'=='Debug' ">true</CopyLocalLockFileAssemblies>
77
<ImplicitUsings>enable</ImplicitUsings>
88
<Nullable>enable</Nullable>
99
<SignAssembly>True</SignAssembly>
1010
<AssemblyOriginatorKeyFile>Benchmark.Development.snk</AssemblyOriginatorKeyFile>
1111
<DelaySign>False</DelaySign>
12+
<SciVersion Condition="'$(SciVersion)' == ''">7.4.0</SciVersion>
13+
<LangVersion>12.0</LangVersion>
1214
</PropertyGroup>
1315

1416
<ItemGroup>
@@ -18,7 +20,7 @@
1820

1921
<ItemGroup>
2022
<PackageReference Include="BenchmarkDotNet" Version="0.15.8" />
21-
<PackageReference Include="Mapster" Version="7.4.0" />
23+
<PackageReference Include="Mapster" Version="$(SciVersion)" />
2224
</ItemGroup>
2325

2426
</Project>

‎src/Benchmark.Development/Benchmarks/Config.cs‎

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using BenchmarkDotNet.Exporters.Csv;
66
using BenchmarkDotNet.Jobs;
77
using BenchmarkDotNet.Loggers;
8+
using Perfolizer.Models;
89

910
namespace Benchmark.Benchmarks
1011
{
@@ -21,18 +22,31 @@ public Config()
2122
AddDiagnoser(MemoryDiagnoser.Default);
2223
AddColumn(TargetMethodColumn.Method);
2324

25+
AddColumn(JobCharacteristicColumn.AllColumns);
26+
AddColumnProvider(DefaultColumnProviders.Params);
2427
AddColumn(StatisticColumn.Mean);
28+
2529
AddColumn(StatisticColumn.StdDev);
2630
AddColumn(StatisticColumn.Error);
2731

2832
AddColumn(BaselineRatioColumn.RatioMean);
2933
AddColumnProvider(DefaultColumnProviders.Metrics);
3034

31-
AddJob(Job.ShortRun
32-
.WithLaunchCount(1)
33-
.WithWarmupCount(2)
34-
.WithIterationCount(10)
35-
);
35+
string[] targetVersions = [
36+
"7.4.0",
37+
"9.0.0-pre01",
38+
];
39+
40+
foreach (var version in targetVersions)
41+
{
42+
AddJob(Job.ShortRun
43+
.WithLaunchCount(1)
44+
.WithWarmupCount(2)
45+
.WithIterationCount(10)
46+
.WithMsBuildArguments($"/p:SciVersion={version}")
47+
.WithId($"v{version}")
48+
);
49+
}
3650

3751
Options |= ConfigOptions.JoinSummary;
3852
}

‎src/Benchmark.Development/Benchmarks/TestAll.cs‎

Lines changed: 1 addition & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -11,48 +11,13 @@ public class TestAll
1111
[Params(100_000)]//, 1_000_000)]
1212
public int Iterations { get; set; }
1313

14-
[Benchmark(Description = "Mapster 7.2.0")]
14+
[Benchmark]
1515
public void MapsterTest()
1616
{
1717
TestAdaptHelper.TestMapsterAdapter<Foo, Foo>(_fooInstance, Iterations);
1818
TestAdaptHelper.TestMapsterAdapter<Customer, CustomerDTO>(_customerInstance, Iterations);
1919
}
2020

21-
//[Benchmark(Description = "Mapster 7.2.0 (Roslyn)")]
22-
//public void RoslynTest()
23-
//{
24-
// TestAdaptHelper.TestMapsterAdapter<Foo, Foo>(_fooInstance, Iterations);
25-
// TestAdaptHelper.TestMapsterAdapter<Customer, CustomerDTO>(_customerInstance, Iterations);
26-
//}
27-
28-
//[Benchmark(Description = "Mapster 7.2.0 (FEC)")]
29-
//public void FecTest()
30-
//{
31-
// TestAdaptHelper.TestMapsterAdapter<Foo, Foo>(_fooInstance, Iterations);
32-
// TestAdaptHelper.TestMapsterAdapter<Customer, CustomerDTO>(_customerInstance, Iterations);
33-
//}
34-
35-
//[Benchmark(Description = "Mapster 7.2.0 (Codegen)")]
36-
//public void CodegenTest()
37-
//{
38-
// TestAdaptHelper.TestCodeGen(_fooInstance, Iterations);
39-
// TestAdaptHelper.TestCodeGen(_customerInstance, Iterations);
40-
//}
41-
42-
//[Benchmark(Description = "ExpressMapper 1.9.1")]
43-
//public void ExpressMapperTest()
44-
//{
45-
// TestAdaptHelper.TestExpressMapper<Foo, Foo>(_fooInstance, Iterations);
46-
// TestAdaptHelper.TestExpressMapper<Customer, CustomerDTO>(_customerInstance, Iterations);
47-
//}
48-
49-
//[Benchmark(Description = "AutoMapper 10.1.1")]
50-
//public void AutoMapperTest()
51-
//{
52-
// TestAdaptHelper.TestAutoMapper<Foo, Foo>(_fooInstance, Iterations);
53-
// TestAdaptHelper.TestAutoMapper<Customer, CustomerDTO>(_customerInstance, Iterations);
54-
//}
55-
5621
[GlobalSetup(Target = nameof(MapsterTest))]
5722
public void SetupMapster()
5823
{
@@ -61,51 +26,5 @@ public void SetupMapster()
6126
TestAdaptHelper.ConfigureMapster(_fooInstance, MapsterCompilerType.Default);
6227
TestAdaptHelper.ConfigureMapster(_customerInstance, MapsterCompilerType.Default);
6328
}
64-
65-
//[GlobalSetup(Target = nameof(RoslynTest))]
66-
//public void SetupRoslyn()
67-
//{
68-
// _fooInstance = TestAdaptHelper.SetupFooInstance();
69-
// _customerInstance = TestAdaptHelper.SetupCustomerInstance();
70-
// TestAdaptHelper.ConfigureMapster(_fooInstance, MapsterCompilerType.Roslyn);
71-
// TestAdaptHelper.ConfigureMapster(_customerInstance, MapsterCompilerType.Roslyn);
72-
//}
73-
74-
//[GlobalSetup(Target = nameof(FecTest))]
75-
//public void SetupFec()
76-
//{
77-
// _fooInstance = TestAdaptHelper.SetupFooInstance();
78-
// _customerInstance = TestAdaptHelper.SetupCustomerInstance();
79-
// TestAdaptHelper.ConfigureMapster(_fooInstance, MapsterCompilerType.FEC);
80-
// TestAdaptHelper.ConfigureMapster(_customerInstance, MapsterCompilerType.FEC);
81-
//}
82-
83-
//[GlobalSetup(Target = nameof(CodegenTest))]
84-
//public void SetupCodegen()
85-
//{
86-
// //_fooInstance = TestAdaptHelper.SetupFooInstance();
87-
// //_customerInstance = TestAdaptHelper.SetupCustomerInstance();
88-
// //FooMapper.Map(_fooInstance);
89-
// //CustomerMapper.Map(_customerInstance);
90-
//}
91-
92-
//[GlobalSetup(Target = nameof(ExpressMapperTest))]
93-
//public void SetupExpressMapper()
94-
//{
95-
// _fooInstance = TestAdaptHelper.SetupFooInstance();
96-
// _customerInstance = TestAdaptHelper.SetupCustomerInstance();
97-
// TestAdaptHelper.ConfigureExpressMapper(_fooInstance);
98-
// TestAdaptHelper.ConfigureExpressMapper(_customerInstance);
99-
//}
100-
101-
//[GlobalSetup(Target = nameof(AutoMapperTest))]
102-
//public void SetupAutoMapper()
103-
//{
104-
// _fooInstance = TestAdaptHelper.SetupFooInstance();
105-
// _customerInstance = TestAdaptHelper.SetupCustomerInstance();
106-
// TestAdaptHelper.ConfigureAutoMapper(_fooInstance);
107-
// TestAdaptHelper.ConfigureAutoMapper(_customerInstance);
108-
//}
109-
11029
}
11130
}

‎src/Benchmark.Development/Benchmarks/TestComplexTypes.cs‎

Lines changed: 1 addition & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -15,77 +15,12 @@ public void MapsterTest()
1515
{
1616
TestAdaptHelper.TestMapsterAdapter<Customer, CustomerDTO>(_customerInstance, Iterations);
1717
}
18-
19-
[Benchmark(Description = "Mapster 6.0.0 (Roslyn)")]
20-
public void RoslynTest()
21-
{
22-
TestAdaptHelper.TestMapsterAdapter<Customer, CustomerDTO>(_customerInstance, Iterations);
23-
}
24-
25-
[Benchmark(Description = "Mapster 6.0.0 (FEC)")]
26-
public void FecTest()
27-
{
28-
TestAdaptHelper.TestMapsterAdapter<Customer, CustomerDTO>(_customerInstance, Iterations);
29-
}
30-
31-
//[Benchmark]
32-
//public void CodegenTest()
33-
//{
34-
// TestAdaptHelper.TestCodeGen(_customerInstance, Iterations);
35-
//}
36-
37-
[Benchmark]
38-
public void ExpressMapperTest()
39-
{
40-
TestAdaptHelper.TestExpressMapper<Customer, CustomerDTO>(_customerInstance, Iterations);
41-
}
42-
43-
[Benchmark]
44-
public void AutoMapperTest()
45-
{
46-
TestAdaptHelper.TestAutoMapper<Customer, CustomerDTO>(_customerInstance, Iterations);
47-
}
48-
18+
4919
[GlobalSetup(Target = nameof(MapsterTest))]
5020
public void SetupMapster()
5121
{
5222
_customerInstance = TestAdaptHelper.SetupCustomerInstance();
5323
TestAdaptHelper.ConfigureMapster(_customerInstance, MapsterCompilerType.Default);
5424
}
55-
56-
[GlobalSetup(Target = nameof(RoslynTest))]
57-
public void SetupRoslyn()
58-
{
59-
_customerInstance = TestAdaptHelper.SetupCustomerInstance();
60-
TestAdaptHelper.ConfigureMapster(_customerInstance, MapsterCompilerType.Roslyn);
61-
}
62-
63-
[GlobalSetup(Target = nameof(FecTest))]
64-
public void SetupFec()
65-
{
66-
_customerInstance = TestAdaptHelper.SetupCustomerInstance();
67-
TestAdaptHelper.ConfigureMapster(_customerInstance, MapsterCompilerType.FEC);
68-
}
69-
70-
/* [GlobalSetup(Target = nameof(CodegenTest))]
71-
public void SetupCodegen()
72-
{
73-
//_customerInstance = TestAdaptHelper.SetupCustomerInstance();
74-
//CustomerMapper.Map(_customerInstance);
75-
}*/
76-
77-
[GlobalSetup(Target = nameof(ExpressMapperTest))]
78-
public void SetupExpressMapper()
79-
{
80-
_customerInstance = TestAdaptHelper.SetupCustomerInstance();
81-
TestAdaptHelper.ConfigureExpressMapper(_customerInstance);
82-
}
83-
84-
//[GlobalSetup(Target = nameof(AutoMapperTest))]
85-
//public void SetupAutoMapper()
86-
//{
87-
// _customerInstance = TestAdaptHelper.SetupCustomerInstance();
88-
// TestAdaptHelper.ConfigureAutoMapper(_customerInstance);
89-
//}
9025
}
9126
}

‎src/Benchmark.Development/Benchmarks/TestSimpleTypes.cs‎

Lines changed: 0 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -16,77 +16,11 @@ public void MapsterTest()
1616
TestAdaptHelper.TestMapsterAdapter<Foo, Foo>(_fooInstance, Iterations);
1717
}
1818

19-
[Benchmark(Description = "Mapster 7.4.0 (Roslyn)")]
20-
public void RoslynTest()
21-
{
22-
TestAdaptHelper.TestMapsterAdapter<Foo, Foo>(_fooInstance, Iterations);
23-
}
24-
25-
//[Benchmark(Description = "Mapster 6.0.0 (FEC)")]
26-
//public void FecTest()
27-
//{
28-
// TestAdaptHelper.TestMapsterAdapter<Foo, Foo>(_fooInstance, Iterations);
29-
//}
30-
31-
//[Benchmark]
32-
//public void CodegenTest()
33-
//{
34-
// TestAdaptHelper.TestCodeGen(_fooInstance, Iterations);
35-
//}
36-
37-
//[Benchmark]
38-
//public void ExpressMapperTest()
39-
//{
40-
// TestAdaptHelper.TestExpressMapper<Foo, Foo>(_fooInstance, Iterations);
41-
//}
42-
43-
//[Benchmark]
44-
//public void AutoMapperTest()
45-
//{
46-
// TestAdaptHelper.TestAutoMapper<Foo, Foo>(_fooInstance, Iterations);
47-
//}
48-
49-
5019
[GlobalSetup(Target = nameof(MapsterTest))]
5120
public void SetupMapster()
5221
{
5322
_fooInstance = TestAdaptHelper.SetupFooInstance();
5423
TestAdaptHelper.ConfigureMapster(_fooInstance, MapsterCompilerType.Default);
5524
}
56-
57-
[GlobalSetup(Target = nameof(RoslynTest))]
58-
public void SetupRoslyn()
59-
{
60-
_fooInstance = TestAdaptHelper.SetupFooInstance();
61-
TestAdaptHelper.ConfigureMapster(_fooInstance, MapsterCompilerType.Roslyn);
62-
}
63-
64-
//[GlobalSetup(Target = nameof(FecTest))]
65-
//public void SetupFec()
66-
//{
67-
// _fooInstance = TestAdaptHelper.SetupFooInstance();
68-
// TestAdaptHelper.ConfigureMapster(_fooInstance, MapsterCompilerType.FEC);
69-
//}
70-
71-
//[GlobalSetup(Target = nameof(CodegenTest))]
72-
//public void SetupCodegen()
73-
//{
74-
// //_fooInstance = TestAdaptHelper.SetupFooInstance();
75-
// //FooMapper.Map(_fooInstance);
76-
//}
77-
78-
//[GlobalSetup(Target = nameof(ExpressMapperTest))]
79-
//public void SetupExpressMapper()
80-
//{
81-
// _fooInstance = TestAdaptHelper.SetupFooInstance();
82-
// TestAdaptHelper.ConfigureExpressMapper(_fooInstance);
83-
//}
84-
85-
//[GlobalSetup(Target = nameof(AutoMapperTest))]
86-
//public void SetupAutoMapper()
87-
//{
88-
// _fooInstance = TestAdaptHelper.SetupFooInstance();
89-
// TestAdaptHelper.ConfigureAutoMapper(_fooInstance);
90-
//}
9125
}
9226
}

‎src/Benchmark.Development/Directory.Build.props‎

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,11 @@
88
<Authors>chaowlert;eric_swann;andrerav</Authors>
99
<Copyright>Copyright (c) $([System.DateTime]::Now.ToString(`yyyy`)) Chaowlert Chaisrichalermpol, Eric Swann, Andreas Ravnestad</Copyright>
1010
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
11-
<PackageProjectUrl>https://github.com/MapsterMapper/Mapster</PackageProjectUrl>
12-
<RepositoryUrl>https://github.com/MapsterMapper/Mapster</RepositoryUrl>
1311
<PackageReleaseNotes></PackageReleaseNotes>
14-
<PackageIcon>logo.png</PackageIcon>
15-
<PackageIconUrl>https://cloud.githubusercontent.com/assets/5763993/26522718/d16f3e42-4330-11e7-9b78-f8c7402624e7.png</PackageIconUrl>
1612
<PackageLicenseExpression>MIT</PackageLicenseExpression>
1713
<SignAssembly>false</SignAssembly>
1814
<PublicSign Condition=" '$(OS)' != 'Windows_NT' ">true</PublicSign>
19-
<PackageTags>Mapper;AutoMapper;Fast;Mapping</PackageTags>
20-
<PackageIcon>icon.png</PackageIcon>
2115
<IsPackable>false</IsPackable>
22-
<LangVersion>10</LangVersion>
16+
<LangVersion>12</LangVersion>
2317
</PropertyGroup>
2418
</Project>

0 commit comments

Comments
 (0)