Test case details

Preparation Code

<script src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.4.4/underscore-min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/1.1.1/lodash.min.js"></script> <script> var lodash = _.noConflict(); </script>
var numbers = []; var object = {}; for (var i = 0; i < 20; i++) { numbers[i] = i; object['key' + i] = i; } var objects = _.map(numbers, function(n) { return { 'num': n }; }); var randomized = _.sortBy(numbers, function() { return Math.random(); });

Test cases

Test #1

var timesTwo = []; _.each(numbers, function(num) { timesTwo.push(num * 2); });

Test #2

var timesTwo = []; lodash.each(numbers, function(num) { timesTwo.push(num * 2); });

Test #3

var timesTwo = []; _.each(object, function(num) { timesTwo.push(num * 2); });

Test #4

var timesTwo = []; lodash.each(object, function(num) { timesTwo.push(num * 2); });

Test #5

_.keys(object);

Test #6

lodash.keys(object);

Test #7

_.map(objects, function(obj) { return obj.num; });

Test #8

lodash.map(objects, function(obj) { return obj.num; });

Test #9

_.pluck(objects, 'num');

Test #10

lodash.pluck(objects, 'num');

Test #11

_.values(objects);

Test #12

lodash.values(objects);