Skip to content

Actualize benchmark#946

Open
Qyperion wants to merge 2 commits into
MapsterMapper:developmentfrom
Qyperion:actualize-benchmark
Open

Actualize benchmark#946
Qyperion wants to merge 2 commits into
MapsterMapper:developmentfrom
Qyperion:actualize-benchmark

Conversation

@Qyperion
Copy link
Copy Markdown

Summary

  • Updated and fixed the benchmark projects for the current toolchain and package versions.
  • Refactored benchmark setup to use shared operation-count configuration and refreshed simple, complex, and combined mapping benchmarks. Also removed commented code in Benchmark project.
  • Added benchmark comparisons for AutoMapper, Facet, and Mapperly alongside Mapster, Mapster Roslyn/FEC/codegen, and AutoMapper.
  • Updated README and package documentation with the latest benchmark results and performance notes.

Copilot AI review requested due to automatic review settings May 12, 2026 16:49
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

  • MapsterVersion is declared in the Mapster.Benchmark.Development namespace, but this file is in Mapster.Benchmark.Development.Benchmarks and doesn’t import the parent namespace. foreach (var version in MapsterVersion.Get()) will not compile without qualifying the type or adding using Mapster.Benchmark.Development;.


            foreach (var version in MapsterVersion.Get())
            {

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/Benchmark.Development/TestAdaptHelper.cs
@DocSvartz
Copy link
Copy Markdown
Contributor

Hi @Qyperion. Great work 👍.

@Qyperion
Copy link
Copy Markdown
Author

@DocSvartz Is there any additional action required from my side for this PR to be merged?
Or just wait for it to be reviewed?

Comment thread README.md
| `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 |
Copy link
Copy Markdown
Contributor

@DocSvartz DocSvartz May 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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" />
Copy link
Copy Markdown
Contributor

@DocSvartz DocSvartz May 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@andrerav @stagep Because of this, dependabot will come back to us again with a message about the Automapper being vulnerable. 😅
If you agree with this PR, then I think it should be disabled dependabot for this dependency.

@DocSvartz
Copy link
Copy Markdown
Contributor

Is there any additional action required from my side for this PR to be merged?
Or just wait for it to be reviewed?

@Qyperion No action is required at this time.

Need to wait for the decision of the other contributors Regarding adding a dependency on Automapper

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants