Actualize benchmark#946
Conversation
There was a problem hiding this comment.
Pull request overview
This PR modernizes the repository’s benchmark projects and documentation to reflect the current toolchain and adds additional mapper library comparisons.
Changes:
- Updated benchmark projects to new namespaces/toolchain and refactored common benchmark parameters via a shared base class.
- Added comparison benchmarks/models for AutoMapper, Facet, and Mapperly alongside Mapster variants (default/Roslyn/FEC/codegen).
- Refreshed README/package docs with an updated benchmark snapshot and performance notes.
Reviewed changes
Copilot reviewed 30 out of 30 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/Benchmark/TestAdaptHelper.cs | Refactors benchmark helper to support AutoMapper/Facet/Mapperly runs and unifies loop logic. |
| src/Benchmark/Program.cs | Updates namespaces/usings for the benchmark entrypoint. |
| src/Benchmark/FooMapper.tt | Updates T4 template namespaces to Mapster.Benchmark. |
| src/Benchmark/FooMapper.g.cs | Regenerated codegen mapper with updated namespace/imports. |
| src/Benchmark/CustomerMapper.tt | Updates T4 template namespaces to Mapster.Benchmark. |
| src/Benchmark/CustomerMapper.g.cs | Regenerated codegen mapper with updated namespace/imports. |
| src/Benchmark/Comparisons/MapperlyModels.cs | Adds Mapperly DTOs + mapping definitions for benchmark comparisons. |
| src/Benchmark/Comparisons/FacetModels.cs | Adds Facet DTOs/attributes for benchmark comparisons. |
| src/Benchmark/Classes/Foo.cs | Moves benchmark model types into Mapster.Benchmark.Classes. |
| src/Benchmark/Classes/Customer.cs | Moves benchmark model types into Mapster.Benchmark.Classes. |
| src/Benchmark/Benchmarks/TestSimpleTypes.cs | Updates benchmark to use shared MapOperations parameter and adds new library runs. |
| src/Benchmark/Benchmarks/TestComplexTypes.cs | Updates benchmark to use shared MapOperations parameter and adds new library runs. |
| src/Benchmark/Benchmarks/TestAll.cs | Updates combined benchmark to use shared MapOperations parameter and adds new library runs. |
| src/Benchmark/Benchmarks/MappingBenchmarkBase.cs | Introduces shared [ParamsSource] for operation counts across benchmarks. |
| src/Benchmark/Benchmarks/Config.cs | Updates benchmark configuration/columns and namespaces. |
| src/Benchmark/Benchmark.csproj | Updates target framework, enables implicit usings, and adds new benchmark dependencies. |
| src/Benchmark.Development/TestAdaptHelper.cs | Updates namespaces for dev benchmarks (but currently breaks Mapster symbol resolution). |
| src/Benchmark.Development/Program.cs | Updates usings for new dev benchmark namespaces. |
| src/Benchmark.Development/MapsterVersion.cs | Updates namespace and refreshes benchmarked Mapster versions list. |
| src/Benchmark.Development/Classes/Foo.cs | Moves dev benchmark model types into new namespace. |
| src/Benchmark.Development/Classes/Customer.cs | Moves dev benchmark model types into new namespace. |
| src/Benchmark.Development/Benchmarks/TestSimpleTypes.cs | Updates namespaces/usings for dev benchmarks. |
| src/Benchmark.Development/Benchmarks/TestComplexTypes.cs | Updates namespaces/usings for dev benchmarks. |
| src/Benchmark.Development/Benchmarks/TestAll.cs | Updates namespaces/usings for dev benchmarks. |
| src/Benchmark.Development/Benchmarks/Config.cs | Updates namespaces (but currently breaks MapsterVersion resolution). |
| src/Benchmark.Development/Benchmark.Development.csproj | Updates root namespace and project settings formatting/structure. |
| src/.editorconfig | Adds formatting rules for csproj/props files. |
| README.md | Updates performance section and benchmark snapshot table. |
| docs/articles/packages/FastExpressionCompiler.md | Updates benchmark snapshot + points to README for full comparison. |
| docs/articles/packages/ExpressionDebugging.md | Replaces outdated Roslyn performance claims with current notes and link to README. |
Comments suppressed due to low confidence (1)
src/Benchmark.Development/Benchmarks/Config.cs:37
MapsterVersionis declared in theMapster.Benchmark.Developmentnamespace, but this file is inMapster.Benchmark.Development.Benchmarksand doesn’t import the parent namespace.foreach (var version in MapsterVersion.Get())will not compile without qualifying the type or addingusing Mapster.Benchmark.Development;.
foreach (var version in MapsterVersion.Get())
{
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Hi @Qyperion. Great work 👍. |
|
@DocSvartz Is there any additional action required from my side for this PR to be merged? |
| | `Mapster 10.0.7 (FEC)` | 1000000 | 124,374 us | 1,290 us | 2,466 us | 0.30 | 74000 | - | 1182.56 MB | 0.95 | | ||
| | `Mapster 10.0.7 (Codegen)` | 1000000 | 105,214 us | 1,312 us | 2,206 us | 0.26 | 75500 | 166 | 1205.44 MB | 0.97 | | ||
| | `AutoMapper 14.0.0` | 1000000 | 600,077 us | 63,170 us | 95,505 us | 1.45 | 197000 | 1000 | 3158.59 MB | 2.54 | | ||
| | `Facet 6.5.5` | 1000000 | 628,280 us | 7,326 us | 11,076 us | 1.52 | 325000 | 1000 | 5187.99 MB | 4.17 | |
There was a problem hiding this comment.
@Qyperion Are you sure this is a valid result?
As far as I know, Facet is a sourcegen mapper.
Very strange metrics for a source code generation based mapper 🤔
|
|
||
| <ItemGroup> | ||
| <PackageReference Include="BenchmarkDotNet" Version="0.15.8" /> | ||
| <PackageReference Include="AutoMapper" Version="14.0.0" /> |
@Qyperion No action is required at this time. Need to wait for the decision of the other contributors Regarding adding a dependency on Automapper |
Summary