add-large-numbers

JavaScript performance comparison

Test case created by malkiz

Preparation code


      
      <script>
Benchmark.prototype.setup = function() {
  var count1 = 0;
  var count2 = new Date().getTime();
  var count3 = 1e5;
  var count4 = 1e9;
  var count5 = 1e12;
  var count6 = 1e15;
  
  function getNum1() {
    return ++count1;
  }
  
  function getNum2() {
    return ++count2;
  }
  
  function getNum3() {
    return ++count3;
  }
  
  function getNum4() {
    return ++count4;
  }
  
  function getNum5() {
    return ++count5;
  }
  
  function getNum6() {
    return ++count6;
  }

};
</script>

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in CCBot 2.0.0 / Other 0.0.0
Test Ops/sec
small
for (var i = 0; i < 100000; i++) {
  var a = getNum1();
}
pending…
large
for (var i = 0; i < 100000; i++) {
  var a = getNum2();
}
pending…
1e5
for (var i = 0; i < 100000; i++) {
  var a = getNum3();
}
pending…
1e9
for (var i = 0; i < 100000; i++) {
  var a = getNum4();
}
pending…
1e12
for (var i = 0; i < 100000; i++) {
  var a = getNum5();
}
pending…
1e15
for (var i = 0; i < 100000; i++) {
  var a = getNum6();
}
pending…

You can edit these tests or add even more tests to this page by appending /edit to the URL.

Compare results of other browsers

0 Comments