Skip to content

Commit 217acb9

Browse files
MrJithiljasnell
authored andcommitted
benchmark: avoid input param manipulation
PR-URL: #41741 Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Mohammed Keyvanzadeh <[email protected]> Reviewed-By: Mestery <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Mary Marchini <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 913c125 commit 217acb9

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)