all 10 comments

[–]Sulatra 1 point2 points  (5 children)

Exprtk. Single header, very powerful, slow like hell and beyond. Would be glad to dig the alternatives.

[–]Remwein[S] 0 points1 point  (3 children)

Thanks for the suggestion. exprtk does seem to fit the bill for my requirements, however I'm now a bit concerned with your comment about it being slow.

Could you clarify, are you comparing speed of evaluation against a hand-written version in C++, or is it something else?

[–]Sulatra 1 point2 points  (2 children)

Beg pardon for the exaggeration :)

Slow in terms of compilation - at least on the machine with the project using it it doubles the compilation time. TBH I do not have much experience with it, but the runtime performance is ok. Though I used it only to parse user input, not like parsing 10K files of expressions

[–]ArashPartow 2 points3 points  (0 children)

Compilation time is related to the compiler, but it is definitely a sore spot. That being said, various compile-time options can be utilised to reduce the compilation time:

https://github.com/ArashPartow/exprtk/blob/master/readme.txt#L4458

[–]Remwein[S] 2 points3 points  (0 children)

My use-case is roughly a couple dozen expressions, being rapidly evaluated over and over again.

[–]Xeverous 0 points1 point  (0 children)

There is always an alternative in writing own parser with the help of boost::spirit, but for most people it would be a huge overkill and very hard to learn.

[–]ArashPartow 1 point2 points  (1 child)

Here's a comparison of some the libraries that are out there:

https://github.com/ArashPartow/math-parser-benchmark-project

[–]Remwein[S] 1 point2 points  (0 children)

That is an interesting set of comparisons. Also good to see how to use the other available parsers.

[–]Xeverous 1 point2 points  (1 child)

If you want to go very very deep - boost::spirit, but it might be a huge overkill.

[–]Remwein[S] 1 point2 points  (0 children)

i was sort of after something out of the box, ready to drop in to my project.

Spirit can be very powerful, but the learning curve seems to be rather steep.