FastExpressionCompiler

June 21, 2021 · View on GitHub

需要更高的性能?使用 FastExpressionCompiler 作为表达式树编译器

安装 nuget 包

 PM> Install-Package FastExpressionCompiler

在配置实例上指定表达式树编译器:

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

替换表达式树编译器后,性能对比结果:

MethodMeanStdDevErrorGen 0Gen 1Gen 2Allocated
'Mapster 4.1.1'115.31 ms0.849 ms1.426 ms31000.0000--124.36 MB
'Mapster 4.1.1 (FEC)'54.70 ms1.023 ms1.546 ms29600.0000--118.26 MB