testing21072013

JavaScript performance comparison

Test case created

Preparation code

 
<script>
Benchmark.prototype.setup = function() {
    var x = {
      a: 1,
      b: 2,
      c: 3,
      d: 4,
      e: "bar"
    };
    var y = [1, 2, 3, 4, "foo"];
    var isArray1 = Array.isArray(y);
    var isArray2 = Array.isArray(x);
};
</script>

Test runner

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

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
right1
var temp = isArray2 ? x : Object.keys(x);
pending…
left1
var temp = !isArray2 ? Object.keys(x) : x;
pending…
right2
var temp = isArray1 ? y : Object.keys(y);
pending…
left2
var temp = !isArray1 ? Object.keys(y) : y;
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

Add a comment