indexOf vs hash (v7)

Revision 7 of this benchmark created on


Setup

var a = [10,23,1,5,66,4,7773,2345,234,345677,879,451,763,138,4572],
    hash = {
    10:true,23:true,1:true,5:true,66:true,4:true,7773:true,2345:true,234:true,345677:true,879:true,451:true,763:true,138:true,4572:true
    }

Test runner

Ready to run.

Testing in
TestOps/sec
indexOf
a.indexOf(2345);
ready
hash
hash[2345]
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(4572);
ready
hash - last element on the array
hash[4572];
ready

Revisions

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