Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 44ca20b

Browse filesBrowse 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
Copy full SHA for 44ca20b

File tree

Expand file treeCollapse file tree

1 file changed

+3
-4
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+3
-4
lines changed
Open diff view settings
Collapse file

‎benchmark/assert/deepequal-object.js‎

Copy file name to clipboardExpand all lines: benchmark/assert/deepequal-object.js
+3-4Lines changed: 3 additions & 4 deletions
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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.