Zepto map vs LoDash map vs Underscore map

JavaScript performance comparison

Test case created by Till

Preparation code

<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/2.4.1/lodash.js"></script>
var lodash = _.noConflict();
<script src="https://cdnjs.cloudflare.com/ajax/libs/zepto/1.1.3/zepto.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.6.0/underscore.js"></script>
var underscore = _.noConflict();

<select id="mySelect">
<option value="500">​500 €​</option>
<option value="1000">​1.000 €​</option>
<option value="1500">​1.500 €​</option>
<option value="2000">​2.000 €​</option>
<option value="2500">​2.500 €​</option>
<option value="3000">​3.000 €​</option>
<option value="3500">​3.500 €​</option>
<option value="4000">​4.000 €​</option>
<option value="4500">​4.500 €​</option>
<option value="5000">​5.000 €​</option>
<option value="6000">​6.000 €​</option>
<option value="7000">​7.000 €​</option>
<option value="8000">​8.000 €​</option>
<option value="9000">​9.000 €​</option>
<option value="10000">​10.000 €​</option>
<option value="11000">​11.000 €​</option>
<option value="12000">​12.000 €​</option>
<option value="13000">​13.000 €​</option>
<option value="14000">​14.000 €​</option>
<option value="15000">​15.000 €​</option>
<option value="17500">​17.500 €​</option>
<option value="20000">​20.000 €​</option>
<option value="22500">​22.500 €​</option>
<option value="25000">​25.000 €​</option>
<option value="27500">​27.500 €​</option>
<option value="30000">​30.000 €​</option>
<option value="35000">​35.000 €​</option>
<option value="40000">​40.000 €​</option>
<option value="45000">​45.000 €​</option>
<option value="50000">​50.000 €​</option>
<option value="55000">​55.000 €​</option>
<option value="60000">​60.000 €​</option>
<option value="70000">​70.000 €​</option>
<option value="80000">​80.000 €​</option>
<option value="90000">​90.000 €​</option>
<option value="-1">​Beliebig​</option>
Benchmark.prototype.setup = function() {
    var $mySelectOptions = $("#mySelect option");

Preparation code output

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
Zepto map
var values = $mySelectOptions.map(function (index, item) { return item.value })
LoDash map
var values = lodash.map($mySelectOptions, function(item) { return item.value });
Underscore map
var values = underscore.map($mySelectOptions, function(item) { return item.value });

Compare results of other browsers


You can edit these tests or add even more tests to this page by appending /edit to the URL. Here’s a list of current revisions for this page:


Comment form temporarily disabled.

Add a comment