-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
benchmark: update benchmark for URLSearchParams.sort #50568
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
const out = []; | ||
for (const key of str.split('&')) { | ||
out.push(key, ''); | ||
out.push(key); | ||
} | ||
return out; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const out = []; | |
for (const key of str.split('&')) { | |
out.push(key, ''); | |
out.push(key); | |
} | |
return out; | |
return str.split('&'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resolved
93667c2
to
28e4257
Compare
Commit Queue failed- Loading data for nodejs/node/pull/50568 ✔ Done loading data for nodejs/node/pull/50568 ----------------------------------- PR info ------------------------------------ Title benchmark: update benchmark for URLSearchParams.sort (#50568) ⚠ Could not retrieve the email or name of the PR author's from user's GitHub profile! Branch zhenweijin:update-benchmark -> nodejs:main Labels url, benchmark, whatwg-url, author ready Commits 1 - benchmark: update benchmark for URLSearchParams.sort Committers 1 - zhenweijin PR-URL: https://github.com/nodejs/node/pull/50568 Fixes: https://github.com/nodejs/node/issues/50566 Reviewed-By: Vinícius Lourenço Claro Cardoso ------------------------------ Generated metadata ------------------------------ PR-URL: https://github.com/nodejs/node/pull/50568 Fixes: https://github.com/nodejs/node/issues/50566 Reviewed-By: Vinícius Lourenço Claro Cardoso -------------------------------------------------------------------------------- ℹ This PR was created on Sun, 05 Nov 2023 17:08:56 GMT ✔ Approvals: 1 ✔ - Vinícius Lourenço Claro Cardoso (@H4ad): https://github.com/nodejs/node/pull/50568#pullrequestreview-1721005209 ✘ This PR needs to wait 91 more hours to land (or 0 hours if there is one more approval) ✔ Last GitHub CI successful ℹ Green GitHub CI is sufficient -------------------------------------------------------------------------------- ✔ Aborted `git node land` session in /home/runner/work/node/node/.ncuhttps://github.com/nodejs/node/actions/runs/6804435402 |
bench.start(); | ||
for (let i = 0; i < n; i++) { | ||
params[searchParams] = array.slice(); | ||
params.sort(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now, this sort
really needed? Its doing the same operation n
times. We are not modifying any values inside the params
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The benchmark is not correct. After first iteration, all items are sorted.
28e4257
to
7e1f1a7
Compare
Good point. As @MrJithil mentioned, |
@anonrig PTAL feel free |
out.push(key, ''); | ||
} | ||
return out; | ||
return str.split('&'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the original getParams
is correct on returning a params initialization array. After the change, it is partial and needs more work at line 33.
Remove
searchParamsSymbol
fromurl-searchparams-sort.js
.Fixes: #50566