$.inArray, _.indexOf, and a simple loop (v33)

Revision 33 of this benchmark created on


Preparation HTML

<script src="//cdnjs.cloudflare.com/ajax/libs/underscore.js/1.3.3/underscore-min.js">
</script>

Setup

var r;
    var array = ['2','3','4','5','6','7','8','9','A','B','C','D','E','F','G','H','J','K','L','M','N','P','Q','R','S','T','W','X','Y','Z','a','b','c','d','e','f','g','h','i','j','k','m','n','o','p','q','r','s','t','u','v','w','x','y','z'];

Test runner

Ready to run.

Testing in
TestOps/sec
_.indexOf isSorted
r = _.indexOf(array, 'p', true) > -1;
ready
_.indexOf
r = _.indexOf(array, 'p') > -1;
ready
[].indexOf
r = array.indexOf('p') >= 0;
ready

Revisions

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