Add a benchmark for _.some with thisArg and avoid corrupting the aggregate score if a single benchmark errors. [ci skip]

Former-commit-id: 2042fdaab870ad2de2fb4938f5033d21f3dd1ae3
This commit is contained in:
John-David Dalton
2012-12-18 01:08:55 -08:00
parent 5c55cf0efb
commit 0d42e84045

View File

@@ -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, '\