Skip to content
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

use safer math.js compile/evaluate to eval user arith expressions #33

Merged
merged 8 commits into from
Oct 9, 2020
Merged

Conversation

yeedle
Copy link
Contributor

@yeedle yeedle commented Sep 29, 2020

See my comment in my original PR #31 (comment). This PR addresses #29

In this PR, I added a cache for expression. On first encounter, the expression is compiled into a JavaScript function using math.js's compile, and on subsequent calls, the evalMath function will used the compiled function rather than recompile every time. In theory this should be even faster than using the built in eval or Function. In practice it's probably the same.

Check it out and let me know what you think!

@tim-salabim tim-salabim merged commit 0bb9461 into r-spatial:master Oct 9, 2020
@tim-salabim
Copy link
Member

Thanks @yeedle ! After a bit of struggling with some manual conflict resolving, I've managed to get this PR into master. It seems to work like a charm, so again, thanks a bunch for all your efforts!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants