Object properties and array items

JavaScript performance comparison

Revision 12 of this test case created

Preparation code

 
<script>
Benchmark.prototype.setup = function() {
    var obj = {
      x: 10,
      y: 15,
      z: 20
    };
   
    var arr = [10, 15, 20];
};
</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;
var y = obj.y;
var z = obj.z;
var x1 = obj.x;
var y1 = obj.y;
var z1 = obj.z;
var x2 = obj.x;
var y2 = obj.y;
var z2 = obj.z;
var x3 = obj.x;
var y3 = obj.y;
var z3 = obj.z;
var x4 = obj.x;
var y4 = obj.y;
var z4 = obj.z;
var x5 = obj.x;
var y5 = obj.y;
var z5 = obj.z;
pending…
Array items
var a = 10;
var b = 10;
var c = 10;

var x = a;
var y = b;
var z = c;
var x1 = a;
var y1 = b;
var z1 = c;
var x2 = a;
var y2 = b;
var z2 = c;
var x3 = a;
var y3 = b;
var z3 = c;
var x4 = a;
var y4 = b;
var z4 = c;
var x5 = a;
var y5 = b;
var z5 = c;
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