Skip to content

Commit abe2eb9

Browse files
MrJithildanielleadams
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 cf6b5e0 commit abe2eb9

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

‎benchmark/assert/deepequal-object.js‎

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

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

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

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

0 commit comments

Comments
 (0)