mirror of https://github.com/nodejs/node.git
benchmark: avoid input param manipulation
PR-URL: https://github.com/nodejs/node/pull/41741 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com> Reviewed-By: Mestery <mestery@protonmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Mary Marchini <oss@mmarchini.me> Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
parent
913c125e98
commit
217acb9036
|
@ -24,8 +24,7 @@ function createObj(source, add = '') {
|
|||
}
|
||||
|
||||
function main({ size, n, method, strict }) {
|
||||
// TODO: Fix this "hack". `n` should not be manipulated.
|
||||
n = Math.min(Math.ceil(n / size), 20);
|
||||
const len = Math.min(Math.ceil(n / size), 20);
|
||||
|
||||
const source = Array.apply(null, Array(size));
|
||||
const actual = createObj(source);
|
||||
|
@ -39,8 +38,8 @@ function main({ size, n, method, strict }) {
|
|||
const value2 = method.includes('not') ? expectedWrong : expected;
|
||||
|
||||
bench.start();
|
||||
for (let i = 0; i < n; ++i) {
|
||||
for (let i = 0; i < len; ++i) {
|
||||
fn(actual, value2);
|
||||
}
|
||||
bench.end(n);
|
||||
bench.end(len);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue