bertiqwerty / exmex

Math parser and evaluator in Rust, capable of partial differentiation, allows the use of custom operators.
Apache License 2.0
39 stars 6 forks source link

Improve eval_flatex performance by 10-20% #38

Closed terrorfisch closed 2 years ago

terrorfisch commented 2 years ago

I restuctured detail::eval_flatex and split the actual evaluation in two function calls.

eval_flatex_bool is basically the old behaviour but I used iterators for scanning the ignore slice which leads to about 10% performance gain.

eval_flatex_u64 can be used to evaluate expression whith up to 64 nodes as it uses a single u64 to track the used numbers. Including it leads to another 10% performance gain in the benchmarks.

bertiqwerty commented 2 years ago

Thanks for your contribution.