Array vs Object Access (v5)

Revision 5 of this benchmark created on


Description

JavaScript arrays are basically just objects with integer property names. Is there any performance difference when accessing an array vs an object?

Setup

var a=[0,1], b={x:0,y:1};

Test runner

Ready to run.

Testing in
TestOps/sec
Array get/set
a = [0,1];
a[0] = a[1] + 1;
ready
Object get/set
b = {x:0,y:1};
b.x = b.y + 1;
ready

Revisions

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