Back to Mapster

Packages - Fast Expression Compiler Support

docs/articles/packages/FastExpressionCompiler.md

10.0.10974 B
Original Source

Need more speed? Let's compile with FastExpressionCompiler.

Installation

Getting the package:

nuget
     PM> Install-Package FastExpressionCompiler

Then add following code on start up

csharp
TypeAdapterConfig.GlobalSettings.Compiler = exp => exp.CompileFast();

That's it. Now your code will enjoy performance boost. Here is a current benchmark snapshot:

MethodMapOperationsMeanStdDevErrorRatioGen0Gen1AllocatedAlloc Ratio
Mapster 10.0.71000000412,534 us2,704 us4,543 us1.0077000-1243.59 MB1.00
Mapster 10.0.7 (FEC)1000000124,374 us1,290 us2,466 us0.3074000-1182.56 MB0.95

See the benchmark snapshot in README for the full comparison.