KO vs. _ (v4)

Revision 4 of this benchmark created on


Preparation HTML

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script src="//underscorejs.org/underscore-min.js"></script>
<script src="//knockoutjs.com/downloads/knockout-3.2.0.js"></script>

Setup

var list = [];
    for (var l = 0; l < 100; l++) {
        list[l] = {
            id: l,
            code: l.toString(),
            text: "Item #" + l
        };
    }
    
    var onLoop = function onLoop(item) {
        return item.id > 60;
    };

Test runner

Ready to run.

Testing in
TestOps/sec
KO arrayFilter
ko.utils.arrayFirst(list, onLoop);
ready
_ filter
_.find(list, onLoop);
ready
jQuery grep
jQuery.grep(list, onLoop);
ready
Native filter
list.filter(onLoop);
ready

Revisions

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