are you kidding me?

JavaScript performance comparison

Revision 4 of this test case created by Justin Meyer

Preparation code


      
      <script>
Benchmark.prototype.setup = function() {
  //
  // To be used to prevent compiling out code without side-effect
  //
  function noop(){}
  var part = new Array(1000).join(" ");

};
</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
insane
var string = Array();
string.push(part);
string.push(part);
string.push(part);
string.push(part);
string.push(part);

// make sure it doesn't compile out
// costs the pagan compiler gods a function call
noop(string.join(""));
pending…
not insane but not advisable
var string = [ part, part, part, part, part ].join("");

// make sure it doesn't compile out
// costs the pagan compiler gods a function call
noop(string);
pending…
is it?
var string = part;
string += part;
string += part;
string += part;
string += part;

// make sure it doesn't compile out
// costs the pagan compiler gods a function call
noop(string);
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