-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(pkg/parser): impl expression eval #54
Conversation
I compared the performance to the govaluate. For the parsing performance, our implementation is about 20x-25x slower than the govaluate. In most cases, it's acceptable. We only parse the expression once when the expression is defined, and then the expression will be stored as an abstract syntax tree in the memory. For the evaluation performance, In our scenarios, our implementation is about 2-8x faster than the govaluate. Notably, in the evaluation with parameters and functions, our implementation's performance is about 8x faster than the govaluate.
|
Update BenchmarksI refactored the expression evaluation and fixed a bug that the code might mutate the value in the context during the expression's evaluation. I fixed that by introducing extra memory allocation during the evaluation, but it also reduced the performance.
As you can see, when the evaluation only involves parameters, the performance was slightly worse than the govalute because it spent about 20% CPU time to allocate memory and copy the primitive's value.
However, we still can be benefited in some scenarios. If the evaluation only involves functions, there are no allocation or copy operations.
|
No description provided.