Skip to content

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

kylo5aby
Copy link
Contributor

@kylo5aby kylo5aby commented Nov 5, 2023

Remove searchParamsSymbol from url-searchparams-sort.js.

Fixes: #50566

@nodejs-github-bot nodejs-github-bot added benchmark Issues and PRs related to the benchmark subsystem. url Issues and PRs related to the legacy built-in url module. whatwg-url Issues and PRs related to the WHATWG URL implementation. labels Nov 5, 2023
Comment on lines 20 to 24
const out = [];
for (const key of str.split('&')) {
out.push(key, '');
out.push(key);
}
return out;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const out = [];
for (const key of str.split('&')) {
out.push(key, '');
out.push(key);
}
return out;
return str.split('&');

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolved

@kylo5aby kylo5aby force-pushed the update-benchmark branch 2 times, most recently from 93667c2 to 28e4257 Compare November 8, 2023 14:41
@H4ad H4ad added author ready PRs that have at least one approval, no pending requests for changes, and a CI started. commit-queue Add this label to land a pull request using GitHub Actions. labels Nov 8, 2023
@nodejs-github-bot nodejs-github-bot added commit-queue-failed An error occurred while landing this pull request using GitHub Actions. and removed commit-queue Add this label to land a pull request using GitHub Actions. labels Nov 8, 2023
@nodejs-github-bot
Copy link
Collaborator

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/.ncu
https://github.com/nodejs/node/actions/runs/6804435402

bench.start();
for (let i = 0; i < n; i++) {
params[searchParams] = array.slice();
params.sort();
Copy link
Member

@MrJithil MrJithil Nov 10, 2023

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

Copy link
Member

@anonrig anonrig left a 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.

@kylo5aby
Copy link
Contributor Author

The benchmark is not correct. After first iteration, all items are sorted.

Good point. As @MrJithil mentioned, params hasn't been changed after first iteration. I have updated it, add a params copy for every iteration.

@debadree25 debadree25 removed author ready PRs that have at least one approval, no pending requests for changes, and a CI started. commit-queue-failed An error occurred while landing this pull request using GitHub Actions. labels Nov 13, 2023
@kylo5aby kylo5aby requested a review from anonrig November 16, 2023 14:41
@kylo5aby
Copy link
Contributor Author

kylo5aby commented Mar 6, 2024

@anonrig PTAL feel free

out.push(key, '');
}
return out;
return str.split('&');
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
benchmark Issues and PRs related to the benchmark subsystem. url Issues and PRs related to the legacy built-in url module. whatwg-url Issues and PRs related to the WHATWG URL implementation.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

url.searchParamsSymbol may affect the benchmark results of URLSearchParams.sort()
8 participants