.map: Underscore.js versus jQuery versus LoDash (v4)

Revision 4 of this benchmark created on


Preparation HTML

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script language="javascript" type="text/javascript">
window.jQuery = $.noConflict()
</script>
<script src="https://zeptojs.com/zepto.min.js"></script>
<script src="https://underscorejs.org/underscore-min.js"></script>
<script language="javascript" type="text/javascript">
window.underscore = _.noConflict();
</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/2.4.1/lodash.compat.js"></script>
<script language="javascript" type="text/javascript">
window.lodash = _.noConflict();
</script>

Setup

var vals = new Array(999)
    for(var i = 0; i < vals.length; i++){vals[i] = i}

Test runner

Ready to run.

Testing in
TestOps/sec
jQuery
jQuery.map(vals, function (i, x) { return i*x })
ready
Underscore.js
underscore.map(vals, function (x, i) { return x*i })
ready
Lo-Dash
lodash.map(vals, function (x, i) { return x*i })
ready
Native
vals.map(function (x, i) { return x*i })
ready
Zepto
Zepto.map(vals, function (i, x) { return i*x })
ready

Revisions

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