https://github.com/dra1ex/feel
Fast Expression Evaluator Library (C++, .NET)
https://github.com/dra1ex/feel
c-plus-plus c-sharp compilation evaluation expression expression-evaluator expressionengine math
Last synced: 4 months ago
JSON representation
Fast Expression Evaluator Library (C++, .NET)
- Host: GitHub
- URL: https://github.com/dra1ex/feel
- Owner: DrA1ex
- Created: 2013-11-16T14:04:34.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2016-06-16T10:05:54.000Z (almost 9 years ago)
- Last Synced: 2024-12-15T05:36:04.527Z (5 months ago)
- Topics: c-plus-plus, c-sharp, compilation, evaluation, expression, expression-evaluator, expressionengine, math
- Language: C++
- Homepage:
- Size: 82 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Fast Expression Evaluator Library (c++, .net)
====Yet another Expression Evaluator, but with **compilation** into **native code**
With this library you can evaluate math expressions fast and easily.Get Started:
---
var expression = new ExpressionEvaluator("sqrt(r^2 - x^2)");expression.SetVariableValue("r", 10);
expression.SetVariableValue("x", 5);Console.WriteLine(expression.Execute());
Also you can see [Tests](https://github.com/DrA1ex/FEEL/tree/master/ExpressionEvaluator.Test), simple demo [project](https://github.com/DrA1ex/FEEL/blob/master/ExpressionCalculatorDemo/Program.cs), [benchmark](https://github.com/DrA1ex/FEEL/blob/master/ExpressionEvaluatorNetBenchmark/Program.cs), or advanced example [Curves Demo](https://github.com/DrA1ex/FEEL.CurveDemo).
Installation:
---
For all platforms:FEEL require Visual C++ 2015 Redistributable. You can download it from here: https://www.microsoft.com/download/details.aspx?id=48145
For .NET version:
Install-Package Feel.Net
For C++:
See [releases](https://github.com/DrA1ex/FEEL/releases) sectionFeatures:
---1. Easy extensible (you can add more operations if you want)
2. Fast (expression **compiling** into **native code**)
3. Powerful (you can use variables and change it without side effects)At this point Expression Evaluator supports only Windows platform.
Compile isn't perfect now, but more faster, than generic solution.
Some benchmarks:
---```
Expression: "(cos(x)^0.5*cos(200*x)+abs(x)^0.5-0.7)*(4-x^2)^0.01"
Start value: -1.5
End value: 1.5
Steps: 1000000 (1m).NET Benchmark results:
Library name Avg. time
FEEL (this library): 343.42 ms
Ciloci.Flee: 376.78 ms (9.72 % slower)
NCalc: 3280.52 ms (855.26 % slower)C# compiled code: 194.35 ms (43.41 % faster)
C++ Benchmark results:
Library name Avg. time
FEEL (this library): 223.8 msC++ compiled code: 123.2 ms (81.3941% faster)
```License:
---
The MIT License