Performance of Array vs. Object (v13)

Revision 13 of this benchmark created by Marcin on


Description

After seeing http://jsperf.com/javascript-associative-vs-non-associative-arrays, I thought the test could be improved.

Setup

var arr = [9, 9],
        obj = {
        one: 9,
        two: 9
        },
        one = 9,
        two = 9;

Test runner

Ready to run.

Testing in
TestOps/sec
Array Performance
var sum = arr[0] + arr[1]
ready
Object Performance
var sum = obj.one + obj.two
ready
Variable performance
var sum = one + two
ready
Primitive performance
var sum = 9 + 9
ready

Revisions

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