Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/boxbeam/crunch_eval
High-performance algebraic expression evaluator for Rust
https://github.com/boxbeam/crunch_eval
Last synced: 21 days ago
JSON representation
High-performance algebraic expression evaluator for Rust
- Host: GitHub
- URL: https://github.com/boxbeam/crunch_eval
- Owner: boxbeam
- Created: 2023-01-14T16:54:51.000Z (almost 2 years ago)
- Default Branch: master
- Last Pushed: 2023-03-04T01:09:49.000Z (almost 2 years ago)
- Last Synced: 2024-11-05T23:09:27.641Z (2 months ago)
- Language: Rust
- Homepage:
- Size: 24.4 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# crunch_eval
High-performance algebraic expression evaluator.## Basic usage:
```
use crunch_eval::expr::Expr;
let expr = Expr::compile("1 + 1").unwrap();
let val: f64 = expr.evaluate_blank().unwrap();
assert_eq!(val, 2.0);
```## Benchmarks:
Expression: `6.5*7.8^2.3 + (3.5^3+7/2)^3 -(5*4/(2-3))*4 + 6.5*7.8^2.3 + (3.5^3+7/2)^3 -(5*4/(2-3))*4 + 6.5*7.8^2.3 + (3.5^3+7/2)^3 -(5*4/(2-3))*4 + 6.5*7.8^2.3 + (3.5^3+7/2)^3 -(5*4/(2-3))*4`
Time to compile long expression:
| compile | time/op (µs) |
|-------------|--------------|
| crunch_eval | 13.56 |
| evalexpr | 32.36 |Time to evaluate long expression:
| eval | time/op (ns) |
|-------------|--------------|
| crunch_eval | 2.97 |
| evalexpr | 5.96 |Expression: `double(x + 1)`
Time to evaluate expression with variable and function:
| eval | time/op (ns) |
|-------------|--------------|
| crunch_eval | 48.46 |
| evalexpr | 341.83 |