indexOf vs direct

Benchmark created on


Setup

var obj = {value: 1, obj: obj};
    var array = [obj, {value:2}, {value:3}, {value:4}, {value:5}, {value:6}]

Test runner

Ready to run.

Testing in
TestOps/sec
Direct access
var obj2 = array[0];
ready
indexOf
var obj2 = array[array.indexOf(obj)];
ready

Revisions

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