fork(1) download
  1. import Sys;
  2. import haxe.Timer;
  3.  
  4. class Bench {
  5. var n0:Int;
  6.  
  7. function new() {
  8. n0 = 0;
  9. }
  10.  
  11. function calc(n:Int):Int {
  12. var n1:Int = n0 + (1 - 2 * (n % 2));
  13. n0 = n;
  14. return n1;
  15. }
  16.  
  17. public static function main() {
  18. // Declaration
  19. var n:Int = 1;
  20.  
  21. // Instantiation
  22. var objBench:Bench = new Bench();
  23.  
  24. // Main process
  25. var t1:Float = haxe.Timer.stamp();
  26. for (i in 0...2147483647) {
  27. n = objBench.calc(n);
  28. }
  29. var t2:Float = haxe.Timer.stamp();
  30. Sys.println("Haxe\t-> " + (t2 - t1) + " secs.");
  31. }
  32. }
  33.  
Runtime error #stdin #stdout #stderr 0.01s 4936KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
prog.js:1: SyntaxError: invalid import expression:
prog.js:1: import Sys;
prog.js:1: ..........^