Built motion from commit 1038d87.|0.0.141
[motion.git] / public / bower_components / lodash / perf / perf.js
1 ;(function() {
2
3   /** Used to access the Firebug Lite panel (set by `run`). */
4   var fbPanel;
5
6   /** Used as a safe reference for `undefined` in pre ES5 environments. */
7   var undefined;
8
9   /** Used as a reference to the global object. */
10   var root = typeof global == 'object' && global || this;
11
12   /** Method and object shortcuts. */
13   var phantom = root.phantom,
14       amd = root.define && define.amd,
15       argv = root.process && process.argv,
16       document = !phantom && root.document,
17       noop = function() {},
18       params = root.arguments,
19       system = root.system;
20
21   /** Add `console.log()` support for Rhino and RingoJS. */
22   var console = root.console || (root.console = { 'log': root.print });
23
24   /** The file path of the lodash file to test. */
25   var filePath = (function() {
26     var min = 0,
27         result = [];
28
29     if (phantom) {
30       result = params = phantom.args;
31     } else if (system) {
32       min = 1;
33       result = params = system.args;
34     } else if (argv) {
35       min = 2;
36       result = params = argv;
37     } else if (params) {
38       result = params;
39     }
40     var last = result[result.length - 1];
41     result = (result.length > min && !/perf(?:\.js)?$/.test(last)) ? last : '../lodash.js';
42
43     if (!amd) {
44       try {
45         result = require('fs').realpathSync(result);
46       } catch (e) {}
47
48       try {
49         result = require.resolve(result);
50       } catch (e) {}
51     }
52     return result;
53   }());
54
55   /** Used to match path separators. */
56   var rePathSeparator = /[\/\\]/;
57
58   /** Used to detect primitive types. */
59   var rePrimitive = /^(?:boolean|number|string|undefined)$/;
60
61   /** Used to match RegExp special characters. */
62   var reSpecialChars = /[.*+?^=!:${}()|[\]\/\\]/g;
63
64   /** The `ui` object. */
65   var ui = root.ui || (root.ui = {
66     'buildPath': basename(filePath, '.js'),
67     'otherPath': 'underscore'
68   });
69
70   /** The lodash build basename. */
71   var buildName = root.buildName = basename(ui.buildPath, '.js');
72
73   /** The other library basename. */
74   var otherName = root.otherName = (function() {
75     var result = basename(ui.otherPath, '.js');
76     return result + (result == buildName ? ' (2)' : '');
77   }());
78
79   /** Used to score performance. */
80   var score = { 'a': [], 'b': [] };
81
82   /** Used to queue benchmark suites. */
83   var suites = [];
84
85   /** Used to resolve a value's internal [[Class]]. */
86   var toString = Object.prototype.toString;
87
88   /** Detect if in a browser environment. */
89   var isBrowser = isHostType(root, 'document') && isHostType(root, 'navigator');
90
91   /** Use a single "load" function. */
92   var load = (typeof require == 'function' && !amd)
93     ? require
94     : noop;
95
96   /** Load lodash. */
97   var lodash = root.lodash || (root.lodash = (
98     lodash = load(filePath) || root._,
99     lodash = lodash._ || lodash,
100     (lodash.runInContext ? lodash.runInContext(root) : lodash),
101     lodash.noConflict()
102   ));
103
104   /** Load Underscore. */
105   var _ = root.underscore || (root.underscore = (
106     _ = load('../vendor/underscore/underscore.js') || root._,
107     _._ || _
108   ));
109
110   /** Load Benchmark.js. */
111   var Benchmark = root.Benchmark || (root.Benchmark = (
112     Benchmark = load('../node_modules/benchmark/benchmark.js') || root.Benchmark,
113     Benchmark = Benchmark.Benchmark || Benchmark,
114     Benchmark.runInContext(lodash.extend({}, root, { '_': lodash }))
115   ));
116
117   /*--------------------------------------------------------------------------*/
118
119   /**
120    * Gets the basename of the given `filePath`. If the file `extension` is passed,
121    * it will be removed from the basename.
122    *
123    * @private
124    * @param {string} path The file path to inspect.
125    * @param {string} extension The extension to remove.
126    * @returns {string} Returns the basename.
127    */
128   function basename(filePath, extension) {
129     var result = (filePath || '').split(rePathSeparator).pop();
130     return (arguments.length < 2)
131       ? result
132       : result.replace(RegExp(extension.replace(reSpecialChars, '\\$&') + '$'), '');
133   }
134
135   /**
136    * Computes the geometric mean (log-average) of an array of values.
137    * See http://en.wikipedia.org/wiki/Geometric_mean#Relationship_with_arithmetic_mean_of_logarithms.
138    *
139    * @private
140    * @param {Array} array The array of values.
141    * @returns {number} The geometric mean.
142    */
143   function getGeometricMean(array) {
144     return Math.pow(Math.E, lodash.reduce(array, function(sum, x) {
145       return sum + Math.log(x);
146     }, 0) / array.length) || 0;
147   }
148
149   /**
150    * Gets the Hz, i.e. operations per second, of `bench` adjusted for the
151    * margin of error.
152    *
153    * @private
154    * @param {Object} bench The benchmark object.
155    * @returns {number} Returns the adjusted Hz.
156    */
157   function getHz(bench) {
158     var result = 1 / (bench.stats.mean + bench.stats.moe);
159     return isFinite(result) ? result : 0;
160   }
161
162   /**
163    * Host objects can return type values that are different from their actual
164    * data type. The objects we are concerned with usually return non-primitive
165    * types of "object", "function", or "unknown".
166    *
167    * @private
168    * @param {*} object The owner of the property.
169    * @param {string} property The property to check.
170    * @returns {boolean} Returns `true` if the property value is a non-primitive, else `false`.
171    */
172   function isHostType(object, property) {
173     if (object == null) {
174       return false;
175     }
176     var type = typeof object[property];
177     return !rePrimitive.test(type) && (type != 'object' || !!object[property]);
178   }
179
180   /**
181    * Logs text to the console.
182    *
183    * @private
184    * @param {string} text The text to log.
185    */
186   function log(text) {
187     console.log(text + '');
188     if (fbPanel) {
189       // Scroll the Firebug Lite panel down.
190       fbPanel.scrollTop = fbPanel.scrollHeight;
191     }
192   }
193
194   /**
195    * Runs all benchmark suites.
196    *
197    * @private (@public in the browser)
198    */
199   function run() {
200     fbPanel = (fbPanel = root.document && document.getElementById('FirebugUI')) &&
201       (fbPanel = (fbPanel = fbPanel.contentWindow || fbPanel.contentDocument).document || fbPanel) &&
202       fbPanel.getElementById('fbPanel1');
203
204     log('\nSit back and relax, this may take a while.');
205     suites[0].run({ 'async': true });
206   }
207
208   /*--------------------------------------------------------------------------*/
209
210   lodash.extend(Benchmark.Suite.options, {
211     'onStart': function() {
212       log('\n' + this.name + ':');
213     },
214     'onCycle': function(event) {
215       log(event.target);
216     },
217     'onComplete': function() {
218       for (var index = 0, length = this.length; index < length; index++) {
219         var bench = this[index];
220         if (bench.error) {
221           var errored = true;
222         }
223       }
224       if (errored) {
225         log('There was a problem, skipping...');
226       }
227       else {
228         var formatNumber = Benchmark.formatNumber,
229             fastest = this.filter('fastest'),
230             fastestHz = getHz(fastest[0]),
231             slowest = this.filter('slowest'),
232             slowestHz = getHz(slowest[0]),
233             aHz = getHz(this[0]),
234             bHz = getHz(this[1]);
235
236         if (fastest.length > 1) {
237           log('It\'s too close to call.');
238           aHz = bHz = slowestHz;
239         }
240         else {
241           var percent = ((fastestHz / slowestHz) - 1) * 100;
242
243           log(
244             fastest[0].name + ' is ' +
245             formatNumber(percent < 1 ? percent.toFixed(2) : Math.round(percent)) +
246             '% faster.'
247           );
248         }
249         // Add score adjusted for margin of error.
250         score.a.push(aHz);
251         score.b.push(bHz);
252       }
253       // Remove current suite from queue.
254       suites.shift();
255
256       if (suites.length) {
257         // Run next suite.
258         suites[0].run({ 'async': true });
259       }
260       else {
261         var aMeanHz = getGeometricMean(score.a),
262             bMeanHz = getGeometricMean(score.b),
263             fastestMeanHz = Math.max(aMeanHz, bMeanHz),
264             slowestMeanHz = Math.min(aMeanHz, bMeanHz),
265             xFaster = fastestMeanHz / slowestMeanHz,
266             percentFaster = formatNumber(Math.round((xFaster - 1) * 100)),
267             message = 'is ' + percentFaster + '% ' + (xFaster == 1 ? '' : '(' + formatNumber(xFaster.toFixed(2)) + 'x) ') + 'faster than';
268
269         // Report results.
270         if (aMeanHz >= bMeanHz) {
271           log('\n' + buildName + ' ' + message + ' ' + otherName + '.');
272         } else {
273           log('\n' + otherName + ' ' + message + ' ' + buildName + '.');
274         }
275       }
276     }
277   });
278
279   /*--------------------------------------------------------------------------*/
280
281   lodash.extend(Benchmark.options, {
282     'async': true,
283     'setup': '\
284       var _ = global.underscore,\
285           lodash = global.lodash,\
286           belt = this.name == buildName ? lodash : _;\
287       \
288       var date = new Date,\
289           limit = 50,\
290           regexp = /x/,\
291           object = {},\
292           objects = Array(limit),\
293           numbers = Array(limit),\
294           fourNumbers = [5, 25, 10, 30],\
295           nestedNumbers = [1, [2], [3, [[4]]]],\
296           nestedObjects = [{}, [{}], [{}, [[{}]]]],\
297           twoNumbers = [12, 23];\
298       \
299       for (var index = 0; index < limit; index++) {\
300         numbers[index] = index;\
301         object["key" + index] = index;\
302         objects[index] = { "num": index };\
303       }\
304       var strNumbers = numbers + "";\
305       \
306       if (typeof assign != "undefined") {\
307         var _assign = _.assign || _.extend,\
308             lodashAssign = lodash.assign;\
309       }\
310       if (typeof bind != "undefined") {\
311         var thisArg = { "name": "fred" };\
312         \
313         var func = function(greeting, punctuation) {\
314           return (greeting || "hi") + " " + this.name + (punctuation || ".");\
315         };\
316         \
317         var _boundNormal = _.bind(func, thisArg),\
318             _boundMultiple = _boundNormal,\
319             _boundPartial = _.bind(func, thisArg, "hi");\
320         \
321         var lodashBoundNormal = lodash.bind(func, thisArg),\
322             lodashBoundMultiple = lodashBoundNormal,\
323             lodashBoundPartial = lodash.bind(func, thisArg, "hi");\
324         \
325         for (index = 0; index < 10; index++) {\
326           _boundMultiple = _.bind(_boundMultiple, { "name": "fred" + index });\
327           lodashBoundMultiple = lodash.bind(lodashBoundMultiple, { "name": "fred" + index });\
328         }\
329       }\
330       if (typeof bindAll != "undefined") {\
331         var bindAllCount = -1,\
332             bindAllObjects = Array(this.count);\
333         \
334         var funcNames = belt.reject(belt.functions(belt).slice(0, 40), function(funcName) {\
335           return /^_/.test(funcName);\
336         });\
337         \
338         // Potentially expensive.\n\
339         for (index = 0; index < this.count; index++) {\
340           bindAllObjects[index] = belt.reduce(funcNames, function(object, funcName) {\
341             object[funcName] = belt[funcName];\
342             return object;\
343           }, {});\
344         }\
345       }\
346       if (typeof chaining != "undefined") {\
347         var even = function(v) { return v % 2 == 0; },\
348             square = function(v) { return v * v; };\
349         \
350         var largeArray = belt.range(10000),\
351             _chaining = _(largeArray).chain(),\
352             lodashChaining = lodash(largeArray).chain();\
353       }\
354       if (typeof compact != "undefined") {\
355         var uncompacted = numbers.slice();\
356         uncompacted[2] = false;\
357         uncompacted[6] = null;\
358         uncompacted[18] = "";\
359       }\
360       if (typeof flowRight != "undefined") {\
361         var compAddOne = function(n) { return n + 1; },\
362             compAddTwo = function(n) { return n + 2; },\
363             compAddThree = function(n) { return n + 3; };\
364         \
365         var _composed = _.flowRight && _.flowRight(compAddThree, compAddTwo, compAddOne),\
366             lodashComposed = lodash.flowRight && lodash.flowRight(compAddThree, compAddTwo, compAddOne);\
367       }\
368       if (typeof countBy != "undefined" || typeof omit != "undefined") {\
369         var wordToNumber = {\
370           "one": 1,\
371           "two": 2,\
372           "three": 3,\
373           "four": 4,\
374           "five": 5,\
375           "six": 6,\
376           "seven": 7,\
377           "eight": 8,\
378           "nine": 9,\
379           "ten": 10,\
380           "eleven": 11,\
381           "twelve": 12,\
382           "thirteen": 13,\
383           "fourteen": 14,\
384           "fifteen": 15,\
385           "sixteen": 16,\
386           "seventeen": 17,\
387           "eighteen": 18,\
388           "nineteen": 19,\
389           "twenty": 20,\
390           "twenty-one": 21,\
391           "twenty-two": 22,\
392           "twenty-three": 23,\
393           "twenty-four": 24,\
394           "twenty-five": 25,\
395           "twenty-six": 26,\
396           "twenty-seven": 27,\
397           "twenty-eight": 28,\
398           "twenty-nine": 29,\
399           "thirty": 30,\
400           "thirty-one": 31,\
401           "thirty-two": 32,\
402           "thirty-three": 33,\
403           "thirty-four": 34,\
404           "thirty-five": 35,\
405           "thirty-six": 36,\
406           "thirty-seven": 37,\
407           "thirty-eight": 38,\
408           "thirty-nine": 39,\
409           "forty": 40\
410         };\
411         \
412         var words = belt.keys(wordToNumber).slice(0, limit);\
413       }\
414       if (typeof flatten != "undefined") {\
415         var _flattenDeep = _.flatten([[1]])[0] !== 1,\
416             lodashFlattenDeep = lodash.flatten([[1]])[0] !== 1;\
417       }\
418       if (typeof isEqual != "undefined") {\
419         var objectOfPrimitives = {\
420           "boolean": true,\
421           "number": 1,\
422           "string": "a"\
423         };\
424         \
425         var objectOfObjects = {\
426           "boolean": new Boolean(true),\
427           "number": new Number(1),\
428           "string": new String("a")\
429         };\
430         \
431         var objectOfObjects2 = {\
432           "boolean": new Boolean(true),\
433           "number": new Number(1),\
434           "string": new String("A")\
435         };\
436         \
437         var object2 = {},\
438             object3 = {},\
439             objects2 = Array(limit),\
440             objects3 = Array(limit),\
441             numbers2 = Array(limit),\
442             numbers3 = Array(limit),\
443             nestedNumbers2 = [1, [2], [3, [[4]]]],\
444             nestedNumbers3 = [1, [2], [3, [[6]]]];\
445         \
446         for (index = 0; index < limit; index++) {\
447           object2["key" + index] = index;\
448           object3["key" + index] = index;\
449           objects2[index] = { "num": index };\
450           objects3[index] = { "num": index };\
451           numbers2[index] = index;\
452           numbers3[index] = index;\
453         }\
454         object3["key" + (limit - 1)] = -1;\
455         objects3[limit - 1].num = -1;\
456         numbers3[limit - 1] = -1;\
457       }\
458       if (typeof matches != "undefined") {\
459         var source = { "num": 9 };\
460         \
461         var _matcher = (_.matches || _.noop)(source),\
462             lodashMatcher = (lodash.matches || lodash.noop)(source);\
463       }\
464       if (typeof multiArrays != "undefined") {\
465         var twentyValues = belt.shuffle(belt.range(20)),\
466             fortyValues = belt.shuffle(belt.range(40)),\
467             hundredSortedValues = belt.range(100),\
468             hundredValues = belt.shuffle(hundredSortedValues),\
469             hundredValues2 = belt.shuffle(hundredValues),\
470             hundredTwentyValues = belt.shuffle(belt.range(120)),\
471             hundredTwentyValues2 = belt.shuffle(hundredTwentyValues),\
472             twoHundredValues = belt.shuffle(belt.range(200)),\
473             twoHundredValues2 = belt.shuffle(twoHundredValues);\
474       }\
475       if (typeof partial != "undefined") {\
476         var func = function(greeting, punctuation) {\
477           return greeting + " fred" + (punctuation || ".");\
478         };\
479         \
480         var _partial = _.partial(func, "hi"),\
481             lodashPartial = lodash.partial(func, "hi");\
482       }\
483       if (typeof template != "undefined") {\
484         var tplData = {\
485           "header1": "Header1",\
486           "header2": "Header2",\
487           "header3": "Header3",\
488           "header4": "Header4",\
489           "header5": "Header5",\
490           "header6": "Header6",\
491           "list": ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10"]\
492         };\
493         \
494         var tpl =\
495           "<div>" +\
496           "<h1 class=\'header1\'><%= header1 %></h1>" +\
497           "<h2 class=\'header2\'><%= header2 %></h2>" +\
498           "<h3 class=\'header3\'><%= header3 %></h3>" +\
499           "<h4 class=\'header4\'><%= header4 %></h4>" +\
500           "<h5 class=\'header5\'><%= header5 %></h5>" +\
501           "<h6 class=\'header6\'><%= header6 %></h6>" +\
502           "<ul class=\'list\'>" +\
503           "<% for (var index = 0, length = list.length; index < length; index++) { %>" +\
504           "<li class=\'item\'><%= list[index] %></li>" +\
505           "<% } %>" +\
506           "</ul>" +\
507           "</div>";\
508         \
509         var tplVerbose =\
510           "<div>" +\
511           "<h1 class=\'header1\'><%= data.header1 %></h1>" +\
512           "<h2 class=\'header2\'><%= data.header2 %></h2>" +\
513           "<h3 class=\'header3\'><%= data.header3 %></h3>" +\
514           "<h4 class=\'header4\'><%= data.header4 %></h4>" +\
515           "<h5 class=\'header5\'><%= data.header5 %></h5>" +\
516           "<h6 class=\'header6\'><%= data.header6 %></h6>" +\
517           "<ul class=\'list\'>" +\
518           "<% for (var index = 0, length = data.list.length; index < length; index++) { %>" +\
519           "<li class=\'item\'><%= data.list[index] %></li>" +\
520           "<% } %>" +\
521           "</ul>" +\
522           "</div>";\
523         \
524         var settingsObject = { "variable": "data" };\
525         \
526         var _tpl = _.template(tpl),\
527             _tplVerbose = _.template(tplVerbose, null, settingsObject);\
528         \
529         var lodashTpl = lodash.template(tpl),\
530             lodashTplVerbose = lodash.template(tplVerbose, null, settingsObject);\
531       }\
532       if (typeof wrap != "undefined") {\
533         var add = function(a, b) {\
534           return a + b;\
535         };\
536         \
537         var average = function(func, a, b) {\
538           return (func(a, b) / 2).toFixed(2);\
539         };\
540         \
541         var _wrapped = _.wrap(add, average);\
542             lodashWrapped = lodash.wrap(add, average);\
543       }\
544       if (typeof zip != "undefined") {\
545         var unzipped = [["a", "b", "c"], [1, 2, 3], [true, false, true]];\
546       }'
547   });
548
549   /*--------------------------------------------------------------------------*/
550
551   suites.push(
552     Benchmark.Suite('`_(...).map(...).filter(...).take(...).value()`')
553       .add(buildName, {
554         'fn': 'lodashChaining.map(square).filter(even).take(100).value()',
555         'teardown': 'function chaining(){}'
556       })
557       .add(otherName, {
558         'fn': '_chaining.map(square).filter(even).take(100).value()',
559         'teardown': 'function chaining(){}'
560       })
561   );
562
563   /*--------------------------------------------------------------------------*/
564
565   suites.push(
566     Benchmark.Suite('`_.assign`')
567       .add(buildName, {
568         'fn': 'lodashAssign({}, object)',
569         'teardown': 'function assign(){}'
570       })
571       .add(otherName, {
572         'fn': '_assign({}, object)',
573         'teardown': 'function assign(){}'
574       })
575   );
576
577   suites.push(
578     Benchmark.Suite('`_.assign` with multiple sources')
579       .add(buildName, {
580         'fn': 'lodashAssign({}, object, object)',
581         'teardown': 'function assign(){}'
582       })
583       .add(otherName, {
584         'fn': '_assign({}, object, object)',
585         'teardown': 'function assign(){}'
586       })
587   );
588
589   /*--------------------------------------------------------------------------*/
590
591   suites.push(
592     Benchmark.Suite('`_.bind` (slow path)')
593       .add(buildName, {
594         'fn': 'lodash.bind(function() { return this.name; }, { "name": "fred" })',
595         'teardown': 'function bind(){}'
596       })
597       .add(otherName, {
598         'fn': '_.bind(function() { return this.name; }, { "name": "fred" })',
599         'teardown': 'function bind(){}'
600       })
601   );
602
603   suites.push(
604     Benchmark.Suite('bound call with arguments')
605       .add(buildName, {
606         'fn': 'lodashBoundNormal("hi", "!")',
607         'teardown': 'function bind(){}'
608       })
609       .add(otherName, {
610         'fn': '_boundNormal("hi", "!")',
611         'teardown': 'function bind(){}'
612       })
613   );
614
615   suites.push(
616     Benchmark.Suite('bound and partially applied call with arguments')
617       .add(buildName, {
618         'fn': 'lodashBoundPartial("!")',
619         'teardown': 'function bind(){}'
620       })
621       .add(otherName, {
622         'fn': '_boundPartial("!")',
623         'teardown': 'function bind(){}'
624       })
625   );
626
627   suites.push(
628     Benchmark.Suite('bound multiple times')
629       .add(buildName, {
630         'fn': 'lodashBoundMultiple()',
631         'teardown': 'function bind(){}'
632       })
633       .add(otherName, {
634         'fn': '_boundMultiple()',
635         'teardown': 'function bind(){}'
636       })
637   );
638
639   /*--------------------------------------------------------------------------*/
640
641   suites.push(
642     Benchmark.Suite('`_.bindAll`')
643       .add(buildName, {
644         'fn': 'lodash.bindAll(bindAllObjects[++bindAllCount], funcNames)',
645         'teardown': 'function bindAll(){}'
646       })
647       .add(otherName, {
648         'fn': '_.bindAll(bindAllObjects[++bindAllCount], funcNames)',
649         'teardown': 'function bindAll(){}'
650       })
651   );
652
653   /*--------------------------------------------------------------------------*/
654
655   suites.push(
656     Benchmark.Suite('`_.clone` with an array')
657       .add(buildName, '\
658         lodash.clone(numbers)'
659       )
660       .add(otherName, '\
661         _.clone(numbers)'
662       )
663   );
664
665   suites.push(
666     Benchmark.Suite('`_.clone` with an object')
667       .add(buildName, '\
668         lodash.clone(object)'
669       )
670       .add(otherName, '\
671         _.clone(object)'
672       )
673   );
674
675   /*--------------------------------------------------------------------------*/
676
677   suites.push(
678     Benchmark.Suite('`_.compact`')
679       .add(buildName, {
680         'fn': 'lodash.compact(uncompacted)',
681         'teardown': 'function compact(){}'
682       })
683       .add(otherName, {
684         'fn': '_.compact(uncompacted)',
685         'teardown': 'function compact(){}'
686       })
687   );
688
689   /*--------------------------------------------------------------------------*/
690
691   suites.push(
692     Benchmark.Suite('`_.countBy` with `callback` iterating an array')
693       .add(buildName, '\
694         lodash.countBy(numbers, function(num) { return num >> 1; })'
695       )
696       .add(otherName, '\
697         _.countBy(numbers, function(num) { return num >> 1; })'
698       )
699   );
700
701   suites.push(
702     Benchmark.Suite('`_.countBy` with `property` name iterating an array')
703       .add(buildName, {
704         'fn': 'lodash.countBy(words, "length")',
705         'teardown': 'function countBy(){}'
706       })
707       .add(otherName, {
708         'fn': '_.countBy(words, "length")',
709         'teardown': 'function countBy(){}'
710       })
711   );
712
713   suites.push(
714     Benchmark.Suite('`_.countBy` with `callback` iterating an object')
715       .add(buildName, {
716         'fn': 'lodash.countBy(wordToNumber, function(num) { return num >> 1; })',
717         'teardown': 'function countBy(){}'
718       })
719       .add(otherName, {
720         'fn': '_.countBy(wordToNumber, function(num) { return num >> 1; })',
721         'teardown': 'function countBy(){}'
722       })
723   );
724
725   /*--------------------------------------------------------------------------*/
726
727   suites.push(
728     Benchmark.Suite('`_.defaults`')
729       .add(buildName, '\
730         lodash.defaults({ "key2": 2, "key6": 6, "key18": 18 }, object)'
731       )
732       .add(otherName, '\
733         _.defaults({ "key2": 2, "key6": 6, "key18": 18 }, object)'
734       )
735   );
736
737   /*--------------------------------------------------------------------------*/
738
739   suites.push(
740     Benchmark.Suite('`_.difference`')
741       .add(buildName, '\
742         lodash.difference(numbers, twoNumbers, fourNumbers)'
743       )
744       .add(otherName, '\
745         _.difference(numbers, twoNumbers, fourNumbers)'
746       )
747   );
748
749   suites.push(
750     Benchmark.Suite('`_.difference` iterating 20 and 40 elements')
751       .add(buildName, {
752         'fn': 'lodash.difference(twentyValues, fortyValues)',
753         'teardown': 'function multiArrays(){}'
754       })
755       .add(otherName, {
756         'fn': '_.difference(twentyValues, fortyValues)',
757         'teardown': 'function multiArrays(){}'
758       })
759   );
760
761   suites.push(
762     Benchmark.Suite('`_.difference` iterating 200 elements')
763       .add(buildName, {
764         'fn': 'lodash.difference(twoHundredValues, twoHundredValues2)',
765         'teardown': 'function multiArrays(){}'
766       })
767       .add(otherName, {
768         'fn': '_.difference(twoHundredValues, twoHundredValues2)',
769         'teardown': 'function multiArrays(){}'
770       })
771   );
772
773   /*--------------------------------------------------------------------------*/
774
775   suites.push(
776     Benchmark.Suite('`_.each` iterating an array')
777       .add(buildName, '\
778         var result = [];\
779         lodash.each(numbers, function(num) {\
780           result.push(num * 2);\
781         })'
782       )
783       .add(otherName, '\
784         var result = [];\
785         _.each(numbers, function(num) {\
786           result.push(num * 2);\
787         })'
788       )
789   );
790
791   suites.push(
792     Benchmark.Suite('`_.each` iterating an object')
793       .add(buildName, '\
794         var result = [];\
795         lodash.each(object, function(num) {\
796           result.push(num * 2);\
797         })'
798       )
799       .add(otherName, '\
800         var result = [];\
801         _.each(object, function(num) {\
802           result.push(num * 2);\
803         })'
804       )
805   );
806
807   /*--------------------------------------------------------------------------*/
808
809   suites.push(
810     Benchmark.Suite('`_.every` iterating an array')
811       .add(buildName, '\
812         lodash.every(numbers, function(num) {\
813           return num < limit;\
814         })'
815       )
816       .add(otherName, '\
817         _.every(numbers, function(num) {\
818           return num < limit;\
819         })'
820       )
821   );
822
823   suites.push(
824     Benchmark.Suite('`_.every` iterating an object')
825       .add(buildName, '\
826         lodash.every(object, function(num) {\
827           return num < limit;\
828         })'
829       )
830       .add(otherName, '\
831         _.every(object, function(num) {\
832           return num < limit;\
833         })'
834       )
835   );
836
837   /*--------------------------------------------------------------------------*/
838
839   suites.push(
840     Benchmark.Suite('`_.filter` iterating an array')
841       .add(buildName, '\
842         lodash.filter(numbers, function(num) {\
843           return num % 2;\
844         })'
845       )
846       .add(otherName, '\
847         _.filter(numbers, function(num) {\
848           return num % 2;\
849         })'
850       )
851   );
852
853   suites.push(
854     Benchmark.Suite('`_.filter` iterating an object')
855       .add(buildName, '\
856         lodash.filter(object, function(num) {\
857           return num % 2\
858         })'
859       )
860       .add(otherName, '\
861         _.filter(object, function(num) {\
862           return num % 2\
863         })'
864       )
865   );
866
867   suites.push(
868     Benchmark.Suite('`_.filter` with `_.matches` shorthand')
869       .add(buildName, {
870         'fn': 'lodash.filter(objects, source)',
871         'teardown': 'function matches(){}'
872       })
873       .add(otherName, {
874         'fn': '_.filter(objects, source)',
875         'teardown': 'function matches(){}'
876       })
877   );
878
879   suites.push(
880     Benchmark.Suite('`_.filter` with `_.matches` predicate')
881       .add(buildName, {
882         'fn': 'lodash.filter(objects, lodashMatcher)',
883         'teardown': 'function matches(){}'
884       })
885       .add(otherName, {
886         'fn': '_.filter(objects, _matcher)',
887         'teardown': 'function matches(){}'
888       })
889   );
890
891   /*--------------------------------------------------------------------------*/
892
893   suites.push(
894     Benchmark.Suite('`_.find` iterating an array')
895       .add(buildName, '\
896         lodash.find(numbers, function(num) {\
897           return num === (limit - 1);\
898         })'
899       )
900       .add(otherName, '\
901         _.find(numbers, function(num) {\
902           return num === (limit - 1);\
903         })'
904       )
905   );
906
907   suites.push(
908     Benchmark.Suite('`_.find` iterating an object')
909       .add(buildName, '\
910         lodash.find(object, function(value, key) {\
911           return /\D9$/.test(key);\
912         })'
913       )
914       .add(otherName, '\
915         _.find(object, function(value, key) {\
916           return /\D9$/.test(key);\
917         })'
918       )
919   );
920
921   // Avoid Underscore induced `OutOfMemoryError` in Rhino and Ringo.
922   suites.push(
923     Benchmark.Suite('`_.find` with `_.matches` shorthand')
924       .add(buildName, {
925         'fn': 'lodash.find(objects, source)',
926         'teardown': 'function matches(){}'
927       })
928       .add(otherName, {
929         'fn': '_.find(objects, source)',
930         'teardown': 'function matches(){}'
931       })
932   );
933
934   /*--------------------------------------------------------------------------*/
935
936   suites.push(
937     Benchmark.Suite('`_.flatten`')
938       .add(buildName, {
939         'fn': 'lodash.flatten(nestedNumbers, !lodashFlattenDeep)',
940         'teardown': 'function flatten(){}'
941       })
942       .add(otherName, {
943         'fn': '_.flatten(nestedNumbers, !_flattenDeep)',
944         'teardown': 'function flatten(){}'
945       })
946   );
947
948   /*--------------------------------------------------------------------------*/
949
950   suites.push(
951     Benchmark.Suite('`_.flattenDeep` nested arrays of numbers')
952       .add(buildName, {
953         'fn': 'lodash.flattenDeep(nestedNumbers)',
954         'teardown': 'function flatten(){}'
955       })
956       .add(otherName, {
957         'fn': '_.flattenDeep(nestedNumbers)',
958         'teardown': 'function flatten(){}'
959       })
960   );
961
962   suites.push(
963     Benchmark.Suite('`_.flattenDeep` nest arrays of objects')
964       .add(buildName, {
965         'fn': 'lodash.flattenDeep(nestedObjects)',
966         'teardown': 'function flatten(){}'
967       })
968       .add(otherName, {
969         'fn': '_.flattenDeep(nestedObjects)',
970         'teardown': 'function flatten(){}'
971       })
972   );
973
974   /*--------------------------------------------------------------------------*/
975
976   suites.push(
977     Benchmark.Suite('`_.flowRight`')
978       .add(buildName, {
979         'fn': 'lodash.flowRight(compAddThree, compAddTwo, compAddOne)',
980         'teardown': 'function flowRight(){}'
981       })
982       .add(otherName, {
983         'fn': '_.flowRight(compAddThree, compAddTwo, compAddOne)',
984         'teardown': 'function flowRight(){}'
985       })
986   );
987
988   suites.push(
989     Benchmark.Suite('composed call')
990       .add(buildName, {
991         'fn': 'lodashComposed(0)',
992         'teardown': 'function flowRight(){}'
993       })
994       .add(otherName, {
995         'fn': '_composed(0)',
996         'teardown': 'function flowRight(){}'
997       })
998   );
999
1000   /*--------------------------------------------------------------------------*/
1001
1002   suites.push(
1003     Benchmark.Suite('`_.functions`')
1004       .add(buildName, '\
1005         lodash.functions(lodash)'
1006       )
1007       .add(otherName, '\
1008         _.functions(lodash)'
1009       )
1010   );
1011
1012   /*--------------------------------------------------------------------------*/
1013
1014   suites.push(
1015     Benchmark.Suite('`_.groupBy` with `callback` iterating an array')
1016       .add(buildName, '\
1017         lodash.groupBy(numbers, function(num) { return num >> 1; })'
1018       )
1019       .add(otherName, '\
1020         _.groupBy(numbers, function(num) { return num >> 1; })'
1021       )
1022   );
1023
1024   suites.push(
1025     Benchmark.Suite('`_.groupBy` with `property` name iterating an array')
1026       .add(buildName, {
1027         'fn': 'lodash.groupBy(words, "length")',
1028         'teardown': 'function countBy(){}'
1029       })
1030       .add(otherName, {
1031         'fn': '_.groupBy(words, "length")',
1032         'teardown': 'function countBy(){}'
1033       })
1034   );
1035
1036   suites.push(
1037     Benchmark.Suite('`_.groupBy` with `callback` iterating an object')
1038       .add(buildName, {
1039         'fn': 'lodash.groupBy(wordToNumber, function(num) { return num >> 1; })',
1040         'teardown': 'function countBy(){}'
1041       })
1042       .add(otherName, {
1043         'fn': '_.groupBy(wordToNumber, function(num) { return num >> 1; })',
1044         'teardown': 'function countBy(){}'
1045       })
1046   );
1047
1048   /*--------------------------------------------------------------------------*/
1049
1050   suites.push(
1051     Benchmark.Suite('`_.includes` searching an array')
1052       .add(buildName, '\
1053         lodash.includes(numbers, limit - 1)'
1054       )
1055       .add(otherName, '\
1056         _.includes(numbers, limit - 1)'
1057       )
1058   );
1059
1060   suites.push(
1061     Benchmark.Suite('`_.includes` searching an object')
1062       .add(buildName, '\
1063         lodash.includes(object, limit - 1)'
1064       )
1065       .add(otherName, '\
1066         _.includes(object, limit - 1)'
1067       )
1068   );
1069
1070   if (lodash.includes('ab', 'ab') && _.includes('ab', 'ab')) {
1071     suites.push(
1072       Benchmark.Suite('`_.includes` searching a string')
1073         .add(buildName, '\
1074           lodash.includes(strNumbers, "," + (limit - 1))'
1075         )
1076         .add(otherName, '\
1077           _.includes(strNumbers, "," + (limit - 1))'
1078         )
1079     );
1080   }
1081
1082   /*--------------------------------------------------------------------------*/
1083
1084   suites.push(
1085     Benchmark.Suite('`_.indexOf`')
1086       .add(buildName, {
1087         'fn': 'lodash.indexOf(hundredSortedValues, 99)',
1088         'teardown': 'function multiArrays(){}'
1089       })
1090       .add(otherName, {
1091         'fn': '_.indexOf(hundredSortedValues, 99)',
1092         'teardown': 'function multiArrays(){}'
1093       })
1094   );
1095
1096   /*--------------------------------------------------------------------------*/
1097
1098   suites.push(
1099     Benchmark.Suite('`_.intersection`')
1100       .add(buildName, '\
1101         lodash.intersection(numbers, twoNumbers, fourNumbers)'
1102       )
1103       .add(otherName, '\
1104         _.intersection(numbers, twoNumbers, fourNumbers)'
1105       )
1106   );
1107
1108   suites.push(
1109     Benchmark.Suite('`_.intersection` iterating 120 elements')
1110       .add(buildName, {
1111         'fn': 'lodash.intersection(hundredTwentyValues, hundredTwentyValues2)',
1112         'teardown': 'function multiArrays(){}'
1113       })
1114       .add(otherName, {
1115         'fn': '_.intersection(hundredTwentyValues, hundredTwentyValues2)',
1116         'teardown': 'function multiArrays(){}'
1117       })
1118   );
1119
1120   /*--------------------------------------------------------------------------*/
1121
1122   suites.push(
1123     Benchmark.Suite('`_.invert`')
1124       .add(buildName, '\
1125         lodash.invert(object)'
1126       )
1127       .add(otherName, '\
1128         _.invert(object)'
1129       )
1130   );
1131
1132   /*--------------------------------------------------------------------------*/
1133
1134   suites.push(
1135     Benchmark.Suite('`_.invokeMap` iterating an array')
1136       .add(buildName, '\
1137         lodash.invokeMap(numbers, "toFixed")'
1138       )
1139       .add(otherName, '\
1140         _.invokeMap(numbers, "toFixed")'
1141       )
1142   );
1143
1144   suites.push(
1145     Benchmark.Suite('`_.invokeMap` with arguments iterating an array')
1146       .add(buildName, '\
1147         lodash.invokeMap(numbers, "toFixed", 1)'
1148       )
1149       .add(otherName, '\
1150         _.invokeMap(numbers, "toFixed", 1)'
1151       )
1152   );
1153
1154   suites.push(
1155     Benchmark.Suite('`_.invokeMap` with a function for `path` iterating an array')
1156       .add(buildName, '\
1157         lodash.invokeMap(numbers, Number.prototype.toFixed, 1)'
1158       )
1159       .add(otherName, '\
1160         _.invokeMap(numbers, Number.prototype.toFixed, 1)'
1161       )
1162   );
1163
1164   suites.push(
1165     Benchmark.Suite('`_.invokeMap` iterating an object')
1166       .add(buildName, '\
1167         lodash.invokeMap(object, "toFixed", 1)'
1168       )
1169       .add(otherName, '\
1170         _.invokeMap(object, "toFixed", 1)'
1171       )
1172   );
1173
1174   /*--------------------------------------------------------------------------*/
1175
1176   suites.push(
1177     Benchmark.Suite('`_.isEqual` comparing primitives')
1178       .add(buildName, {
1179         'fn': '\
1180           lodash.isEqual(1, "1");\
1181           lodash.isEqual(1, 1)',
1182         'teardown': 'function isEqual(){}'
1183       })
1184       .add(otherName, {
1185         'fn': '\
1186           _.isEqual(1, "1");\
1187           _.isEqual(1, 1);',
1188         'teardown': 'function isEqual(){}'
1189       })
1190   );
1191
1192   suites.push(
1193     Benchmark.Suite('`_.isEqual` comparing primitives and their object counterparts (edge case)')
1194       .add(buildName, {
1195         'fn': '\
1196           lodash.isEqual(objectOfPrimitives, objectOfObjects);\
1197           lodash.isEqual(objectOfPrimitives, objectOfObjects2)',
1198         'teardown': 'function isEqual(){}'
1199       })
1200       .add(otherName, {
1201         'fn': '\
1202           _.isEqual(objectOfPrimitives, objectOfObjects);\
1203           _.isEqual(objectOfPrimitives, objectOfObjects2)',
1204         'teardown': 'function isEqual(){}'
1205       })
1206   );
1207
1208   suites.push(
1209     Benchmark.Suite('`_.isEqual` comparing arrays')
1210       .add(buildName, {
1211         'fn': '\
1212           lodash.isEqual(numbers, numbers2);\
1213           lodash.isEqual(numbers2, numbers3)',
1214         'teardown': 'function isEqual(){}'
1215       })
1216       .add(otherName, {
1217         'fn': '\
1218           _.isEqual(numbers, numbers2);\
1219           _.isEqual(numbers2, numbers3)',
1220         'teardown': 'function isEqual(){}'
1221       })
1222   );
1223
1224   suites.push(
1225     Benchmark.Suite('`_.isEqual` comparing nested arrays')
1226       .add(buildName, {
1227         'fn': '\
1228           lodash.isEqual(nestedNumbers, nestedNumbers2);\
1229           lodash.isEqual(nestedNumbers2, nestedNumbers3)',
1230         'teardown': 'function isEqual(){}'
1231       })
1232       .add(otherName, {
1233         'fn': '\
1234           _.isEqual(nestedNumbers, nestedNumbers2);\
1235           _.isEqual(nestedNumbers2, nestedNumbers3)',
1236         'teardown': 'function isEqual(){}'
1237       })
1238   );
1239
1240   suites.push(
1241     Benchmark.Suite('`_.isEqual` comparing arrays of objects')
1242       .add(buildName, {
1243         'fn': '\
1244           lodash.isEqual(objects, objects2);\
1245           lodash.isEqual(objects2, objects3)',
1246         'teardown': 'function isEqual(){}'
1247       })
1248       .add(otherName, {
1249         'fn': '\
1250           _.isEqual(objects, objects2);\
1251           _.isEqual(objects2, objects3)',
1252         'teardown': 'function isEqual(){}'
1253       })
1254   );
1255
1256   suites.push(
1257     Benchmark.Suite('`_.isEqual` comparing objects')
1258       .add(buildName, {
1259         'fn': '\
1260           lodash.isEqual(object, object2);\
1261           lodash.isEqual(object2, object3)',
1262         'teardown': 'function isEqual(){}'
1263       })
1264       .add(otherName, {
1265         'fn': '\
1266           _.isEqual(object, object2);\
1267           _.isEqual(object2, object3)',
1268         'teardown': 'function isEqual(){}'
1269       })
1270   );
1271
1272   /*--------------------------------------------------------------------------*/
1273
1274   suites.push(
1275     Benchmark.Suite('`_.isArguments`, `_.isDate`, `_.isFunction`, `_.isNumber`, `_.isObject`, `_.isRegExp`')
1276       .add(buildName, '\
1277         lodash.isArguments(arguments);\
1278         lodash.isArguments(object);\
1279         lodash.isDate(date);\
1280         lodash.isDate(object);\
1281         lodash.isFunction(lodash);\
1282         lodash.isFunction(object);\
1283         lodash.isNumber(1);\
1284         lodash.isNumber(object);\
1285         lodash.isObject(object);\
1286         lodash.isObject(1);\
1287         lodash.isRegExp(regexp);\
1288         lodash.isRegExp(object)'
1289       )
1290       .add(otherName, '\
1291         _.isArguments(arguments);\
1292         _.isArguments(object);\
1293         _.isDate(date);\
1294         _.isDate(object);\
1295         _.isFunction(_);\
1296         _.isFunction(object);\
1297         _.isNumber(1);\
1298         _.isNumber(object);\
1299         _.isObject(object);\
1300         _.isObject(1);\
1301         _.isRegExp(regexp);\
1302         _.isRegExp(object)'
1303       )
1304   );
1305
1306   /*--------------------------------------------------------------------------*/
1307
1308   suites.push(
1309     Benchmark.Suite('`_.keys` (uses native `Object.keys` if available)')
1310       .add(buildName, '\
1311         lodash.keys(object)'
1312       )
1313       .add(otherName, '\
1314         _.keys(object)'
1315       )
1316   );
1317
1318   /*--------------------------------------------------------------------------*/
1319
1320   suites.push(
1321     Benchmark.Suite('`_.lastIndexOf`')
1322       .add(buildName, {
1323         'fn': 'lodash.lastIndexOf(hundredSortedValues, 0)',
1324         'teardown': 'function multiArrays(){}'
1325       })
1326       .add(otherName, {
1327         'fn': '_.lastIndexOf(hundredSortedValues, 0)',
1328         'teardown': 'function multiArrays(){}'
1329       })
1330   );
1331
1332   /*--------------------------------------------------------------------------*/
1333
1334   suites.push(
1335     Benchmark.Suite('`_.map` iterating an array')
1336       .add(buildName, '\
1337         lodash.map(objects, function(value) {\
1338           return value.num;\
1339         })'
1340       )
1341       .add(otherName, '\
1342         _.map(objects, function(value) {\
1343           return value.num;\
1344         })'
1345       )
1346   );
1347
1348   suites.push(
1349     Benchmark.Suite('`_.map` iterating an object')
1350       .add(buildName, '\
1351         lodash.map(object, function(value) {\
1352           return value;\
1353         })'
1354       )
1355       .add(otherName, '\
1356         _.map(object, function(value) {\
1357           return value;\
1358         })'
1359       )
1360   );
1361
1362   suites.push(
1363     Benchmark.Suite('`_.map` with `_.property` shorthand')
1364       .add(buildName, '\
1365         lodash.map(objects, "num")'
1366       )
1367       .add(otherName, '\
1368         _.map(objects, "num")'
1369       )
1370   );
1371
1372   /*--------------------------------------------------------------------------*/
1373
1374   suites.push(
1375     Benchmark.Suite('`_.max`')
1376       .add(buildName, '\
1377         lodash.max(numbers)'
1378       )
1379       .add(otherName, '\
1380         _.max(numbers)'
1381       )
1382   );
1383
1384   /*--------------------------------------------------------------------------*/
1385
1386   suites.push(
1387     Benchmark.Suite('`_.min`')
1388       .add(buildName, '\
1389         lodash.min(numbers)'
1390       )
1391       .add(otherName, '\
1392         _.min(numbers)'
1393       )
1394   );
1395
1396   /*--------------------------------------------------------------------------*/
1397
1398   suites.push(
1399     Benchmark.Suite('`_.omit` iterating 20 properties, omitting 2 keys')
1400       .add(buildName, '\
1401         lodash.omit(object, "key6", "key13")'
1402       )
1403       .add(otherName, '\
1404         _.omit(object, "key6", "key13")'
1405       )
1406   );
1407
1408   suites.push(
1409     Benchmark.Suite('`_.omit` iterating 40 properties, omitting 20 keys')
1410       .add(buildName, {
1411         'fn': 'lodash.omit(wordToNumber, words)',
1412         'teardown': 'function omit(){}'
1413       })
1414       .add(otherName, {
1415         'fn': '_.omit(wordToNumber, words)',
1416         'teardown': 'function omit(){}'
1417       })
1418   );
1419
1420   /*--------------------------------------------------------------------------*/
1421
1422   suites.push(
1423     Benchmark.Suite('`_.partial` (slow path)')
1424       .add(buildName, {
1425         'fn': 'lodash.partial(function(greeting) { return greeting + " " + this.name; }, "hi")',
1426         'teardown': 'function partial(){}'
1427       })
1428       .add(otherName, {
1429         'fn': '_.partial(function(greeting) { return greeting + " " + this.name; }, "hi")',
1430         'teardown': 'function partial(){}'
1431       })
1432   );
1433
1434   suites.push(
1435     Benchmark.Suite('partially applied call with arguments')
1436       .add(buildName, {
1437         'fn': 'lodashPartial("!")',
1438         'teardown': 'function partial(){}'
1439       })
1440       .add(otherName, {
1441         'fn': '_partial("!")',
1442         'teardown': 'function partial(){}'
1443       })
1444   );
1445
1446   /*--------------------------------------------------------------------------*/
1447
1448   suites.push(
1449     Benchmark.Suite('`_.partition` iterating an array')
1450       .add(buildName, '\
1451         lodash.partition(numbers, function(num) {\
1452           return num % 2;\
1453         })'
1454       )
1455       .add(otherName, '\
1456         _.partition(numbers, function(num) {\
1457           return num % 2;\
1458         })'
1459       )
1460   );
1461
1462   suites.push(
1463     Benchmark.Suite('`_.partition` iterating an object')
1464       .add(buildName, '\
1465         lodash.partition(object, function(num) {\
1466           return num % 2;\
1467         })'
1468       )
1469       .add(otherName, '\
1470         _.partition(object, function(num) {\
1471           return num % 2;\
1472         })'
1473       )
1474   );
1475
1476   /*--------------------------------------------------------------------------*/
1477
1478   suites.push(
1479     Benchmark.Suite('`_.pick`')
1480       .add(buildName, '\
1481         lodash.pick(object, "key6", "key13")'
1482       )
1483       .add(otherName, '\
1484         _.pick(object, "key6", "key13")'
1485       )
1486   );
1487
1488   /*--------------------------------------------------------------------------*/
1489
1490   suites.push(
1491     Benchmark.Suite('`_.reduce` iterating an array')
1492       .add(buildName, '\
1493         lodash.reduce(numbers, function(result, value, index) {\
1494           result[index] = value;\
1495           return result;\
1496         }, {})'
1497       )
1498       .add(otherName, '\
1499         _.reduce(numbers, function(result, value, index) {\
1500           result[index] = value;\
1501           return result;\
1502         }, {})'
1503       )
1504   );
1505
1506   suites.push(
1507     Benchmark.Suite('`_.reduce` iterating an object')
1508       .add(buildName, '\
1509         lodash.reduce(object, function(result, value, key) {\
1510           result.push(key, value);\
1511           return result;\
1512         }, [])'
1513       )
1514       .add(otherName, '\
1515         _.reduce(object, function(result, value, key) {\
1516           result.push(key, value);\
1517           return result;\
1518         }, [])'
1519       )
1520   );
1521
1522   /*--------------------------------------------------------------------------*/
1523
1524   suites.push(
1525     Benchmark.Suite('`_.reduceRight` iterating an array')
1526       .add(buildName, '\
1527         lodash.reduceRight(numbers, function(result, value, index) {\
1528           result[index] = value;\
1529           return result;\
1530         }, {})'
1531       )
1532       .add(otherName, '\
1533         _.reduceRight(numbers, function(result, value, index) {\
1534           result[index] = value;\
1535           return result;\
1536         }, {})'
1537       )
1538   );
1539
1540   suites.push(
1541     Benchmark.Suite('`_.reduceRight` iterating an object')
1542       .add(buildName, '\
1543         lodash.reduceRight(object, function(result, value, key) {\
1544           result.push(key, value);\
1545           return result;\
1546         }, [])'
1547       )
1548       .add(otherName, '\
1549         _.reduceRight(object, function(result, value, key) {\
1550           result.push(key, value);\
1551           return result;\
1552         }, [])'
1553       )
1554   );
1555
1556   /*--------------------------------------------------------------------------*/
1557
1558   suites.push(
1559     Benchmark.Suite('`_.reject` iterating an array')
1560       .add(buildName, '\
1561         lodash.reject(numbers, function(num) {\
1562           return num % 2;\
1563         })'
1564       )
1565       .add(otherName, '\
1566         _.reject(numbers, function(num) {\
1567           return num % 2;\
1568         })'
1569       )
1570   );
1571
1572   suites.push(
1573     Benchmark.Suite('`_.reject` iterating an object')
1574       .add(buildName, '\
1575         lodash.reject(object, function(num) {\
1576           return num % 2;\
1577         })'
1578       )
1579       .add(otherName, '\
1580         _.reject(object, function(num) {\
1581           return num % 2;\
1582         })'
1583       )
1584   );
1585
1586   /*--------------------------------------------------------------------------*/
1587
1588   suites.push(
1589     Benchmark.Suite('`_.sampleSize`')
1590       .add(buildName, '\
1591         lodash.sampleSize(numbers, limit / 2)'
1592       )
1593       .add(otherName, '\
1594         _.sampleSize(numbers, limit / 2)'
1595       )
1596   );
1597
1598   /*--------------------------------------------------------------------------*/
1599
1600   suites.push(
1601     Benchmark.Suite('`_.shuffle`')
1602       .add(buildName, '\
1603         lodash.shuffle(numbers)'
1604       )
1605       .add(otherName, '\
1606         _.shuffle(numbers)'
1607       )
1608   );
1609
1610   /*--------------------------------------------------------------------------*/
1611
1612   suites.push(
1613     Benchmark.Suite('`_.size` with an object')
1614       .add(buildName, '\
1615         lodash.size(object)'
1616       )
1617       .add(otherName, '\
1618         _.size(object)'
1619       )
1620   );
1621
1622   /*--------------------------------------------------------------------------*/
1623
1624   suites.push(
1625     Benchmark.Suite('`_.some` iterating an array')
1626       .add(buildName, '\
1627         lodash.some(numbers, function(num) {\
1628           return num == (limit - 1);\
1629         })'
1630       )
1631       .add(otherName, '\
1632         _.some(numbers, function(num) {\
1633           return num == (limit - 1);\
1634         })'
1635       )
1636   );
1637
1638   suites.push(
1639     Benchmark.Suite('`_.some` iterating an object')
1640       .add(buildName, '\
1641         lodash.some(object, function(num) {\
1642           return num == (limit - 1);\
1643         })'
1644       )
1645       .add(otherName, '\
1646         _.some(object, function(num) {\
1647           return num == (limit - 1);\
1648         })'
1649       )
1650   );
1651
1652   /*--------------------------------------------------------------------------*/
1653
1654   suites.push(
1655     Benchmark.Suite('`_.sortBy` with `callback`')
1656       .add(buildName, '\
1657         lodash.sortBy(numbers, function(num) { return Math.sin(num); })'
1658       )
1659       .add(otherName, '\
1660         _.sortBy(numbers, function(num) { return Math.sin(num); })'
1661       )
1662   );
1663
1664   suites.push(
1665     Benchmark.Suite('`_.sortBy` with `property` name')
1666       .add(buildName, {
1667         'fn': 'lodash.sortBy(words, "length")',
1668         'teardown': 'function countBy(){}'
1669       })
1670       .add(otherName, {
1671         'fn': '_.sortBy(words, "length")',
1672         'teardown': 'function countBy(){}'
1673       })
1674   );
1675
1676   /*--------------------------------------------------------------------------*/
1677
1678   suites.push(
1679     Benchmark.Suite('`_.sortedIndex`')
1680       .add(buildName, '\
1681         lodash.sortedIndex(numbers, limit)'
1682       )
1683       .add(otherName, '\
1684         _.sortedIndex(numbers, limit)'
1685       )
1686   );
1687
1688   /*--------------------------------------------------------------------------*/
1689
1690   suites.push(
1691     Benchmark.Suite('`_.sortedIndexBy`')
1692       .add(buildName, {
1693         'fn': '\
1694           lodash.sortedIndexBy(words, "twenty-five", function(value) {\
1695             return wordToNumber[value];\
1696           })',
1697         'teardown': 'function countBy(){}'
1698       })
1699       .add(otherName, {
1700         'fn': '\
1701           _.sortedIndexBy(words, "twenty-five", function(value) {\
1702             return wordToNumber[value];\
1703           })',
1704         'teardown': 'function countBy(){}'
1705       })
1706   );
1707
1708   /*--------------------------------------------------------------------------*/
1709
1710   suites.push(
1711     Benchmark.Suite('`_.sortedIndexOf`')
1712       .add(buildName, {
1713         'fn': 'lodash.sortedIndexOf(hundredSortedValues, 99)',
1714         'teardown': 'function multiArrays(){}'
1715       })
1716       .add(otherName, {
1717         'fn': '_.sortedIndexOf(hundredSortedValues, 99)',
1718         'teardown': 'function multiArrays(){}'
1719       })
1720   );
1721
1722   /*--------------------------------------------------------------------------*/
1723
1724   suites.push(
1725     Benchmark.Suite('`_.sortedLastIndexOf`')
1726       .add(buildName, {
1727         'fn': 'lodash.sortedLastIndexOf(hundredSortedValues, 0)',
1728         'teardown': 'function multiArrays(){}'
1729       })
1730       .add(otherName, {
1731         'fn': '_.sortedLastIndexOf(hundredSortedValues, 0)',
1732         'teardown': 'function multiArrays(){}'
1733       })
1734   );
1735
1736   /*--------------------------------------------------------------------------*/
1737
1738   suites.push(
1739     Benchmark.Suite('`_.sum`')
1740       .add(buildName, '\
1741         lodash.sum(numbers)'
1742       )
1743       .add(otherName, '\
1744         _.sum(numbers)'
1745       )
1746   );
1747
1748   /*--------------------------------------------------------------------------*/
1749
1750   suites.push(
1751     Benchmark.Suite('`_.template` (slow path)')
1752       .add(buildName, {
1753         'fn': 'lodash.template(tpl)(tplData)',
1754         'teardown': 'function template(){}'
1755       })
1756       .add(otherName, {
1757         'fn': '_.template(tpl)(tplData)',
1758         'teardown': 'function template(){}'
1759       })
1760   );
1761
1762   suites.push(
1763     Benchmark.Suite('compiled template')
1764       .add(buildName, {
1765         'fn': 'lodashTpl(tplData)',
1766         'teardown': 'function template(){}'
1767       })
1768       .add(otherName, {
1769         'fn': '_tpl(tplData)',
1770         'teardown': 'function template(){}'
1771       })
1772   );
1773
1774   suites.push(
1775     Benchmark.Suite('compiled template without a with-statement')
1776       .add(buildName, {
1777         'fn': 'lodashTplVerbose(tplData)',
1778         'teardown': 'function template(){}'
1779       })
1780       .add(otherName, {
1781         'fn': '_tplVerbose(tplData)',
1782         'teardown': 'function template(){}'
1783       })
1784   );
1785
1786   /*--------------------------------------------------------------------------*/
1787
1788   suites.push(
1789     Benchmark.Suite('`_.times`')
1790       .add(buildName, '\
1791         var result = [];\
1792         lodash.times(limit, function(n) { result.push(n); })'
1793       )
1794       .add(otherName, '\
1795         var result = [];\
1796         _.times(limit, function(n) { result.push(n); })'
1797       )
1798   );
1799
1800   /*--------------------------------------------------------------------------*/
1801
1802   suites.push(
1803     Benchmark.Suite('`_.toArray` with an array (edge case)')
1804       .add(buildName, '\
1805         lodash.toArray(numbers)'
1806       )
1807       .add(otherName, '\
1808         _.toArray(numbers)'
1809       )
1810   );
1811
1812   suites.push(
1813     Benchmark.Suite('`_.toArray` with an object')
1814       .add(buildName, '\
1815         lodash.toArray(object)'
1816       )
1817       .add(otherName, '\
1818         _.toArray(object)'
1819       )
1820   );
1821
1822   /*--------------------------------------------------------------------------*/
1823
1824   suites.push(
1825     Benchmark.Suite('`_.toPairs`')
1826       .add(buildName, '\
1827         lodash.toPairs(object)'
1828       )
1829       .add(otherName, '\
1830         _.toPairs(object)'
1831       )
1832   );
1833
1834   /*--------------------------------------------------------------------------*/
1835
1836   suites.push(
1837     Benchmark.Suite('`_.unescape` string without html entities')
1838       .add(buildName, '\
1839         lodash.unescape("`&`, `<`, `>`, `\\"`, and `\'`")'
1840       )
1841       .add(otherName, '\
1842         _.unescape("`&`, `<`, `>`, `\\"`, and `\'`")'
1843       )
1844   );
1845
1846   suites.push(
1847     Benchmark.Suite('`_.unescape` string with html entities')
1848       .add(buildName, '\
1849         lodash.unescape("`&amp;`, `&lt;`, `&gt;`, `&quot;`, and `&#39;`")'
1850       )
1851       .add(otherName, '\
1852         _.unescape("`&amp;`, `&lt;`, `&gt;`, `&quot;`, and `&#39;`")'
1853       )
1854   );
1855
1856   /*--------------------------------------------------------------------------*/
1857
1858   suites.push(
1859     Benchmark.Suite('`_.union`')
1860       .add(buildName, '\
1861         lodash.union(numbers, twoNumbers, fourNumbers)'
1862       )
1863       .add(otherName, '\
1864         _.union(numbers, twoNumbers, fourNumbers)'
1865       )
1866   );
1867
1868   suites.push(
1869     Benchmark.Suite('`_.union` iterating an array of 200 elements')
1870       .add(buildName, {
1871         'fn': 'lodash.union(hundredValues, hundredValues2)',
1872         'teardown': 'function multiArrays(){}'
1873       })
1874       .add(otherName, {
1875         'fn': '_.union(hundredValues, hundredValues2)',
1876         'teardown': 'function multiArrays(){}'
1877       })
1878   );
1879
1880   /*--------------------------------------------------------------------------*/
1881
1882   suites.push(
1883     Benchmark.Suite('`_.uniq`')
1884       .add(buildName, '\
1885         lodash.uniq(numbers.concat(twoNumbers, fourNumbers))'
1886       )
1887       .add(otherName, '\
1888         _.uniq(numbers.concat(twoNumbers, fourNumbers))'
1889       )
1890   );
1891
1892   suites.push(
1893     Benchmark.Suite('`_.uniq` iterating an array of 200 elements')
1894       .add(buildName, {
1895         'fn': 'lodash.uniq(twoHundredValues)',
1896         'teardown': 'function multiArrays(){}'
1897       })
1898       .add(otherName, {
1899         'fn': '_.uniq(twoHundredValues)',
1900         'teardown': 'function multiArrays(){}'
1901       })
1902   );
1903
1904   /*--------------------------------------------------------------------------*/
1905
1906   suites.push(
1907     Benchmark.Suite('`_.uniqBy`')
1908       .add(buildName, '\
1909         lodash.uniqBy(numbers.concat(twoNumbers, fourNumbers), function(num) {\
1910           return num % 2;\
1911         })'
1912       )
1913       .add(otherName, '\
1914         _.uniqBy(numbers.concat(twoNumbers, fourNumbers), function(num) {\
1915           return num % 2;\
1916         })'
1917       )
1918   );
1919
1920   /*--------------------------------------------------------------------------*/
1921
1922   suites.push(
1923     Benchmark.Suite('`_.values`')
1924       .add(buildName, '\
1925         lodash.values(object)'
1926       )
1927       .add(otherName, '\
1928         _.values(object)'
1929       )
1930   );
1931
1932   /*--------------------------------------------------------------------------*/
1933
1934   suites.push(
1935     Benchmark.Suite('`_.without`')
1936       .add(buildName, '\
1937         lodash.without(numbers, 9, 12, 14, 15)'
1938       )
1939       .add(otherName, '\
1940         _.without(numbers, 9, 12, 14, 15)'
1941       )
1942   );
1943
1944   /*--------------------------------------------------------------------------*/
1945
1946   suites.push(
1947     Benchmark.Suite('`_.wrap` result called')
1948       .add(buildName, {
1949         'fn': 'lodashWrapped(2, 5)',
1950         'teardown': 'function wrap(){}'
1951       })
1952       .add(otherName, {
1953         'fn': '_wrapped(2, 5)',
1954         'teardown': 'function wrap(){}'
1955       })
1956   );
1957
1958   /*--------------------------------------------------------------------------*/
1959
1960   suites.push(
1961     Benchmark.Suite('`_.zip`')
1962       .add(buildName, {
1963         'fn': 'lodash.zip.apply(lodash, unzipped)',
1964         'teardown': 'function zip(){}'
1965       })
1966       .add(otherName, {
1967         'fn': '_.zip.apply(_, unzipped)',
1968         'teardown': 'function zip(){}'
1969       })
1970   );
1971
1972   /*--------------------------------------------------------------------------*/
1973
1974   if (Benchmark.platform + '') {
1975     log(Benchmark.platform);
1976   }
1977   // Expose `run` to be called later when executing in a browser.
1978   if (document) {
1979     root.run = run;
1980   } else {
1981     run();
1982   }
1983 }.call(this));