Skip to content

Commit

Permalink
benchmark: avoid input param manipulation
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
MrJithil authored and danielleadams committed Mar 8, 2022
1 parent 01c223f commit 7ba7614
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions benchmark/assert/deepequal-object.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
}

0 comments on commit 7ba7614

Please sign in to comment.