jQuery inArray vs Underscore contains (v3)

Revision 3 of this benchmark created on


Preparation HTML

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script>
<script src="http://documentcloud.github.io/underscore/underscore-min.js">
</script>

Setup

var r;
    var array = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '11', '12', '33', '44', '55', '66', '77', '88', '99'];

Test runner

Ready to run.

Testing in
TestOps/sec
$.inArray
r = $.inArray('33', array);
ready
_.contains
r = _.contains(array, '33');
ready

Revisions

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