Pow2

JavaScript performance comparison

Revision 4 of this test case created by

Preparation code


      
      <script>
Benchmark.prototype.setup = function() {
  this.sqr = function(x) {
    return x * x;
  }

};
</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
mult
var i = 0;
var len = 100;
var a = 0;
while (i < len) {
  a += i * i;
  i++;
}
pending…
pow
var i = 0;
var len = 100;
var a = 0;
while (i < len) {
  a += Math.pow(i, 2);
  i++;
}
pending…
sqr
var i = 0;
var len = 100;
var a = 0;
while (i < len) {
  a += this.sqr(2);
  i++;
}
pending…
sqr-defined
var sqr = new Function('x', 'return x*x');

var i = 0;
var len = 100;
var a = 0;
while (i < len) {
  a += sqr(2);
  i++;
}
pending…

Compare results of other browsers

Revisions

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

0 Comments