2.3.1 / FastExpressionCompiler
What's Changed
- Added
IExpressionCompiler
interface, which allows you to inject your own compiler. This is useful if you want to use a different compiler or if you want to customize the compilation process in some way. - Released
MathEvaluator.FastExpressionCompiler
library is an extension of theMathEvaluator
library that uses the FastExpressionCompiler library to provide performance improvements of up to 10-40x compared to the built-in .NETLambdaExpression.Compile()
method. - Enhanced benchmarks to compare standard and fast expression compilation.
- Added logo.
- Updated documentation.
- Added other minor improvements.
Example of using the MathEvaluator.FastExpressionCompiler
, more details in documentation:
using MathEvaluation.Extensions;
// Compile a double expression
var compiled = "x * y + z".CompileFast(new { x = 0, y = 0, z = 0 });
double result = compiled(new { x = 5, y = 6, z = 7 }); // Result: 47
// Compile a decimal expression
var compiledDecimal = "x / y".CompileDecimalFast(new { x = 0m, y = 0m });
decimal decimalResult = compiledDecimal(new { x = 20m, y = 4m }); // Result: 5
// Compile a boolean expression
var compiledBoolean = "x > y".CompileBooleanFast(new { x = 0, y = 0 });
bool booleanResult = compiledBoolean(new { x = 2, y = 3 }); // Result: false
// Compile a complex expression
var compiledComplex = "x + y * i".CompileComplexFast(new { x = 0, y = 0 });
Complex complexResult = compiledComplex(new { x = 3, y = 4 }); // Result: 3 + 4i
Full Changelog: 2.3.0...2.3.1