final Context context = Lang.context("{num:0}");
context.set("z", z);
System.out.println("\n" + Strings.dup('=', 100));
Stopwatch sw = Stopwatch.run(new Atom() {
public void run() {
int num = 0;
for (int i = 0; i < max; i++)
num = num + (i - 1 + 2 - 3 + 4 - 5 + 6 - 7) - z.abc(i);
System.out.println("Num: " + num);
}
});
System.out.println("\n" + Strings.dup('=', 100));
Stopwatch sw3 = Stopwatch.run(new Atom() {
public void run() {
try {
context.set("num", 0);
for (int i = 0; i < max; i++)
context.set("num", El.eval(context.set("i", i), elstr));
System.out.println("Num: " + context.getInt("num"));
}
catch (Exception e) {
throw Lang.wrapThrow(e);
}
}
});
System.out.println("\n" + Strings.dup('=', 100));
Stopwatch sw4 = Stopwatch.run(new Atom() {
public void run() {
try {
El el2pre = new El(elstr);
context.set("num", 0);
context.set("z", z);
for (int i = 0; i < max; i++)
context.set("num", el2pre.eval(context.set("i", i)));
System.out.println("Num: " + context.getInt("num"));
}
catch (Exception e) {
throw Lang.wrapThrow(e);
}
}
});
System.out.println("\n" + Strings.dup('=', 100));
Stopwatch sw5 = Stopwatch.run(new Atom() {
public void run() {
try {
El el2pre = new El(elstr);
context.set("num", 0);
context.set("z", z);