underscore find vs findWhere

Benchmark created on


Preparation HTML

<script src="//underscorejs.org/underscore-min.js"></script>

Setup

var list = _.range(2000).map(function (num) { return { value: num }; });
    var findThisValue = 1000;

Test runner

Ready to run.

Testing in
TestOps/sec
_.find
var found = _.find(list, function (item) { return item.value === findThisValue; });
ready
_.findWhere
var found = _.findWhere(list, { value: findThisValue });
ready

Revisions

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