Object properties and array items

JavaScript performance comparison

Revision 7 of this test case created

Preparation code

 
<script>
Benchmark.prototype.setup = function() {
    var obj = {
      x: 10,
      y: "15",
      z: true
    };
   
    var arr = [10, "15", true];
   
};
</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
Object properties
var x = obj.x + 1;
var y = obj.y + "1";
var z = obj.z && true;
pending…
Array items
var x = arr[0] + 1;
var y = arr[1] + "1";
var z = arr[2] && true;
pending…
Object property names
var x = obj['x'] + 1;
var y = obj['y'] + "1";
var z = obj['z'] && true;
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. Here’s a list of current revisions for this page:

0 comments

Add a comment