Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
benchmark: avoid input param manipulation
  • Loading branch information
MrJithil committed Jan 29, 2022
commit 5fa6094f5157fdf355e595cf33883a8644f1b3e7
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);
}