Skip to content

Commit 44ca20b

Browse files
MrJithilruyadorno
authored andcommitted
benchmark: avoid input param manipulation
PR-URL: #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>
1 parent 3676505 commit 44ca20b

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

benchmark/assert/deepequal-object.js

+3-4
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ function createObj(source, add = '') {
2424
}
2525

2626
function main({ size, n, method, strict }) {
27-
// TODO: Fix this "hack". `n` should not be manipulated.
28-
n = Math.min(Math.ceil(n / size), 20);
27+
const len = Math.min(Math.ceil(n / size), 20);
2928

3029
const source = Array.apply(null, Array(size));
3130
const actual = createObj(source);
@@ -39,8 +38,8 @@ function main({ size, n, method, strict }) {
3938
const value2 = method.includes('not') ? expectedWrong : expected;
4039

4140
bench.start();
42-
for (let i = 0; i < n; ++i) {
41+
for (let i = 0; i < len; ++i) {
4342
fn(actual, value2);
4443
}
45-
bench.end(n);
44+
bench.end(len);
4645
}

0 commit comments

Comments
 (0)