mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-08 10:17:48 +00:00
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:
17
perf/perf.js
17
perf/perf.js
@@ -78,7 +78,8 @@
|
|||||||
* @returns {Number} Returns the adjusted Hz.
|
* @returns {Number} Returns the adjusted Hz.
|
||||||
*/
|
*/
|
||||||
function getHz(bench) {
|
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(
|
suites.push(
|
||||||
Benchmark.Suite('`_.some` iterating an object')
|
Benchmark.Suite('`_.some` iterating an object')
|
||||||
.add(buildName, '\
|
.add(buildName, '\
|
||||||
|
|||||||
Reference in New Issue
Block a user