Array vs Object lookup (v2)

Revision 2 of this benchmark created on


Setup

var array = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
    var obj = {
      zero: 0,
      one: 1,
      two: 2,
      three: 3,
      four: 4,
      five: 5,
      six: 6,
      seven: 7,
      eight: 8,
      nine: 9,
      ten: 10
    };

Test runner

Ready to run.

Testing in
TestOps/sec
array
return array[5];
ready
object
return obj.five;
ready

Revisions

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