From 0d42e840455ecff5e4aebbacd454f799c53a7cad Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Tue, 18 Dec 2012 01:08:55 -0800 Subject: [PATCH] Add a benchmark for `_.some` with `thisArg` and avoid corrupting the aggregate score if a single benchmark errors. [ci skip] Former-commit-id: 2042fdaab870ad2de2fb4938f5033d21f3dd1ae3 --- perf/perf.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/perf/perf.js b/perf/perf.js index d8dda55b3..625e9ee9e 100644 --- a/perf/perf.js +++ b/perf/perf.js @@ -78,7 +78,8 @@ * @returns {Number} Returns the adjusted Hz. */ function getHz(bench) { - return 1 / (bench.stats.mean + bench.stats.moe); + var result = 1 / (bench.stats.mean + bench.stats.moe); + return isFinite(result) ? result : 0; } /** @@ -1419,6 +1420,20 @@ ) ); + suites.push( + Benchmark.Suite('`_.some` with `thisArg` iterating an array (slow path)') + .add(buildName, '\ + lodash.some(objects, function(value, index) {\ + return this["key" + index] == 19;\ + }, object)' + ) + .add(otherName, '\ + _.some(objects, function(value, index) {\ + return this["key" + index] == 19;\ + }, object)' + ) + ); + suites.push( Benchmark.Suite('`_.some` iterating an object') .add(buildName, '\