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

Reusing compiled/evaluated code #32

Closed
danielsvane opened this issue Dec 26, 2016 · 4 comments
Closed

Reusing compiled/evaluated code #32

danielsvane opened this issue Dec 26, 2016 · 4 comments

Comments

@danielsvane
Copy link

I'm trying to generate an isosurface, and right now I'm running the same expression, with replaced variables 15000+ times. Is there any way to optimize this call:

Algebrite.eval(eq, "a", a, "b", b)

Thanks for all your work.

@davidedc
Copy link
Owner

Hi, yes in the Zeno branch there are some JS code generation facilities. I'll have to refine and document them, but if you look for "generation" you'll find the trail.

@danielsvane
Copy link
Author

My best bet is findDependenciesInScript(), which kinda generates JS code, but doesn't replace "cos", "sin" and "e^x" gets replaced with "Math.pow(exp(1), x)". For now I made a parser in nearley to get JS code I can eval, but it's not a very elegant solution.

@davidedc
Copy link
Owner

davidedc commented Jan 2, 2017

my vote goes for using/improving that code generation facility. It's a draft, true, but I'm going to keep working on it, so I'd find any improvements on that very useful, they will be included and maintained...

@danielsvane
Copy link
Author

After updating to 1.0, the code generation works well for my use case. Algebrite.findDependenciesInScript("expression")[1] successfully returns a JS expression that can be evaluated. The name of the function is not the greatest, but I'm not gonna complain. Thanks for maintaining and updating this library, it has helped me a great deal.

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

No branches or pull requests

2 participants