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

Usage question #1

Open
nelson2005 opened this issue Dec 7, 2015 · 7 comments
Open

Usage question #1

nelson2005 opened this issue Dec 7, 2015 · 7 comments

Comments

@nelson2005
Copy link

in mptest.cpp, I saw something like

e1.create(ctx, "expression", mathpresso::kMPOptionNone)

and in mathpresso.cpp,

// Fallback to evaluation if JIT compiling failed or not enabled.

What might cause the JIT to fail? Is there some place in the interface where I can detect whether or not the JIT failed?

@kobalicek
Copy link
Owner

Well, the only reason to fail is if there is no memory (if heap or virtual allocation fails) or there is a bug in the JIT code generation. Normally, it shouldn't fail.

I think that this is historical, I wrote MathPresso initially for comparison between evaluated code and executed code. In MPSL there is no "evaluation" mode, for example.

@nelson2005
Copy link
Author

Okay, thanks. I was intentionally sending in an expression with a syntax error to see how create() worked, and noticed that comment. My particular test was kicking out at the MPParser::parse() phase because I referenced an undefined variable.

@kobalicek
Copy link
Owner

I think you will be excited after you see MPSL, it's much more advanced than MathPresso, but also takes more time to develop :)

@nelson2005
Copy link
Author

I am excited about it! Of course I realize that you have lots of other things that you're doing as well.

By the way, what's your sense about the speed of separate statements vs a single one? For example, would you expect "z = x + y; z+ 7" to be a different speed than "x + y + 7"?

@kobalicek
Copy link
Owner

It could be. MathPresso doesn't schedule the machine code generated, so if you reorder the expression a bit you can achieve better performance, but don't expect so much, it's unpredictable I think. Reordering is a task in asmjit I didn't finish yet, so this whole thing can be solved at a different layer without complicating MP itself.

BTW yeah, a lot of things I'm working on. I'm not that skilled in compiler construction so MPSL takes a lot of time, but I would like to release MPSL even before Blend2D.

@nelson2005
Copy link
Author

Okay, thanks. Have you ever done any benchmarks comparing it to normally compiled code?

@nelson2005
Copy link
Author

this is very nice, I'm having loads of fun with it. I can only imagine how good MPSL will be!

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