I have been trying different libraries for math parsing, including, Exp4j, Jeval, Jep and Mesp.
my performance is focused on the android development, and currently I have only tested on the Android emulator (slow as sin) and I have to say that Mesp has the best performance of the group, although it is the only one currently set up with a ExpressionTree, I believe jeval also has expression tree, so I have yet to properly test it.
BUT, I just wanted to say that this library is very very fast and awesome to use.
so far (in seconds on android emulator without debug, 1000 iterations):
Exp4j Average Time: 0.014022999999999999
Jeval Average Time: 0.027663
Jep Average Time: 0.010093
MESP Average Time: 0.0021469999999999996
now to see if I can figure out if the rest of the libraries have ExpressionTree implementations.
Thanks!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I couldn't find an edit button sooo…. double post :-)
I took a bit to figure out more efficient methods to do the calculations for the other libraries and I ended up with this:
Exp4j Average Time: 0.00071
Jeval Average Time: 0.02689
Jep Average Time: 0.00072
MESP Average Time: 0.00237
so it seems it comes in third on the emulator, I plan on testing it on my android device, but I am still in the process of finding more libraries to test.
also if you could suggest a faster way of doing this, that would be awesome!
public double TestMesp(String Function, int repeatCount)
{
double startTime = 0;
double totalTime = 0;
double count = 0;
String s = "floor((Right+1-Left)/2)";
Expression x = ExpressionTree.parse(s);
VarMap vm = new VarMap(false /* case sensitive */);
FuncMap fm = new FuncMap(); // no functions in expression
for (int i = 0; i < repeatCount; i++) {
startTime = System.currentTimeMillis();
vm.setValue("Right", 60);
vm.setValue("Left", 20);
fm.loadDefaultFunctions();
x.eval(vm, fm);
totalTime += (System.currentTimeMillis() - startTime);
count++;
}
return (totalTime / count) / 1000.0;
}
ps, the setValue inside the loop is purposeful, I want it to be as if the code is looping through an excel sheet grabbing the current values in the row etc…
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have been trying different libraries for math parsing, including, Exp4j, Jeval, Jep and Mesp.
my performance is focused on the android development, and currently I have only tested on the Android emulator (slow as sin) and I have to say that Mesp has the best performance of the group, although it is the only one currently set up with a ExpressionTree, I believe jeval also has expression tree, so I have yet to properly test it.
BUT, I just wanted to say that this library is very very fast and awesome to use.
so far (in seconds on android emulator without debug, 1000 iterations):
now to see if I can figure out if the rest of the libraries have ExpressionTree implementations.
Thanks!
I couldn't find an edit button sooo…. double post :-)
I took a bit to figure out more efficient methods to do the calculations for the other libraries and I ended up with this:
so it seems it comes in third on the emulator, I plan on testing it on my android device, but I am still in the process of finding more libraries to test.
also if you could suggest a faster way of doing this, that would be awesome!
ps, the setValue inside the loop is purposeful, I want it to be as if the code is looping through an excel sheet grabbing the current values in the row etc…
ooops one small correction, it WAS the fastest i had the fm.loadDefaultFunctions() inside the loop!
now it ends up with:
fantastic speed!!