-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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
benchmark: add a benchmark for URLSearchParams creation and toString() #46810
benchmark: add a benchmark for URLSearchParams creation and toString() #46810
Conversation
I am also trying to improve the perf of confidence improvement accuracy (*) (**) (***)
url/url-searchparams-toString.js n=1000000 type='array' *** 23.29 % ±4.91% ±6.54% ±8.51%
url/url-searchparams-toString.js n=1000000 type='encodelast' -4.55 % ±4.63% ±6.16% ±8.03%
url/url-searchparams-toString.js n=1000000 type='encodemany' * -4.37 % ±3.99% ±5.31% ±6.92%
url/url-searchparams-toString.js n=1000000 type='multiprimitives' -4.40 % ±4.43% ±5.90% ±7.68%
url/url-searchparams-toString.js n=1000000 type='noencode' -1.37 % ±4.41% ±5.87% ±7.64% Trying to follow the cues from the code of https://github.com/anonrig/fast-querystring but it seems the main bottleneck lies in the regex checking over Line 78 in f15896c
which is required for spec compliance I believe? so cannot entirely copy the code from https://github.com/anonrig/fast-querystring too? If anyone has any more ideas would be grateful!! |
|
||
bench.start(); | ||
for (let i = 0; i < n; i++) | ||
new URLSearchParams(input).toString(); |
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.
If you are only testing the performance of toString,
it feels like initialization should not be inside the bench.
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.
Maybe we should spilt it into two, there is also no benchmark for the creation of the URLSearchParams object would that be good?
1c52b18
to
b2bd057
Compare
Used all types of possible parameter types for |
cc @nodejs/performance @nodejs/url |
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 it might be more useful to compare it against querystring than on itself.
Is there any example of comparative benchmarks with other functions in our benchmark tests? |
Ok we already have |
This comment was marked as outdated.
This comment was marked as outdated.
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.
lgtm
Landed in 28c9fb9 |
Refs: nodejs/performance#56 PR-URL: #46810 Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Daijiro Wachi <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Rafael Gonzaga <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
Refs: nodejs/performance#56 PR-URL: #46810 Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Daijiro Wachi <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Rafael Gonzaga <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
Refs: nodejs/performance#56 PR-URL: #46810 Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Daijiro Wachi <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Rafael Gonzaga <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
Was trying to work on nodejs/performance#56 noticed there is no benchmark on
URLSearchParams.toString()
hence adding one same asbenchmark/querystring/querystring-stringify.js
Refs: nodejs/performance#56