indexOf vs hash (v6)

Revision 6 of this benchmark created on


Setup

var a = [10, 23, 1],
          hash = {
            10: true,
            23: true,
            1: true
          }

Test runner

Ready to run.

Testing in
TestOps/sec
indexOf
a.indexOf(23);
ready
hash
hash[23]
ready
indeOf - first element on the array
a.indexOf(10);
ready
hash - first element on the array
hash[10];
ready
indeOf - last element on the array
a.indexOf(1);
ready
hash - last element on the array
hash[1];
ready

Revisions

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