import Sys;
import haxe.Timer;
class Bench {
var n0:Int;
function new() {
n0 = 0;
}
function calc(n:Int):Int {
var n1:Int = n0 + (1 - 2 * (n % 2));
n0 = n;
return n1;
}
public static function main() {
// Declaration
var n:Int = 1;
// Instantiation
var objBench:Bench = new Bench();
// Main process
var t1:Float = haxe.Timer.stamp();
for (i in 0...2147483647) {
n = objBench.calc(n);
}
var t2:Float = haxe.Timer.stamp();
Sys.println("Haxe\t-> " + (t2 - t1) + " secs.");
}
}
aW1wb3J0IFN5czsKaW1wb3J0IGhheGUuVGltZXI7CgpjbGFzcyBCZW5jaCB7Cgl2YXIgbjA6SW50OwoKCWZ1bmN0aW9uIG5ldygpIHsKCQluMCA9IDA7Cgl9CgoJZnVuY3Rpb24gY2FsYyhuOkludCk6SW50IHsKCQl2YXIgbjE6SW50ID0gbjAgKyAoMSAtIDIgKiAobiAlIDIpKTsKCQluMCA9IG47CgkJcmV0dXJuIG4xOwoJfQoKCXB1YmxpYyBzdGF0aWMgZnVuY3Rpb24gbWFpbigpIHsKCQkvLyBEZWNsYXJhdGlvbgoJCXZhciBuOkludCA9IDE7CgoJCS8vIEluc3RhbnRpYXRpb24KCQl2YXIgb2JqQmVuY2g6QmVuY2ggPSBuZXcgQmVuY2goKTsKCgkJLy8gTWFpbiBwcm9jZXNzCgkJdmFyIHQxOkZsb2F0ID0gaGF4ZS5UaW1lci5zdGFtcCgpOwoJCWZvciAoaSBpbiAwLi4uMjE0NzQ4MzY0NykgewoJCQluID0gb2JqQmVuY2guY2FsYyhuKTsKCQl9CgkJdmFyIHQyOkZsb2F0ID0gaGF4ZS5UaW1lci5zdGFtcCgpOwoJCVN5cy5wcmludGxuKCJIYXhlXHQtPiAiICsgKHQyIC0gdDEpICsgIiBzZWNzLiIpOwoJfQp9Cg==