-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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: URLSearchParams v.s. querystring #11170
Conversation
Benchmark results"filename", "configuration", "rate", "time" "url/legacy-vs-whatwg-url-searchparams-parse.js", "n=100000 method=""legacy"" type=""noencode""", 701665.7988113234, 0.142517991 "url/legacy-vs-whatwg-url-searchparams-parse.js", "n=100000 method=""whatwg"" type=""noencode""", 552666.4181657383, 0.180940974 "url/legacy-vs-whatwg-url-searchparams-parse.js", "n=100000 method=""legacy"" type=""encodemany""", 329444.5913401272, 0.30354118 "url/legacy-vs-whatwg-url-searchparams-parse.js", "n=100000 method=""whatwg"" type=""encodemany""", 303372.93978298944, 0.32962729 "url/legacy-vs-whatwg-url-searchparams-parse.js", "n=100000 method=""legacy"" type=""encodelast""", 588217.7271682303, 0.170005077 "url/legacy-vs-whatwg-url-searchparams-parse.js", "n=100000 method=""whatwg"" type=""encodelast""", 387422.55156841147, 0.258116105 "url/legacy-vs-whatwg-url-searchparams-parse.js", "n=100000 method=""legacy"" type=""multivalue""", 585475.1473030588, 0.170801443 "url/legacy-vs-whatwg-url-searchparams-parse.js", "n=100000 method=""whatwg"" type=""multivalue""", 450455.16196795536, 0.221997678 "url/legacy-vs-whatwg-url-searchparams-parse.js", "n=100000 method=""legacy"" type=""multivaluemany""", 234961.99196077543, 0.42560075 "url/legacy-vs-whatwg-url-searchparams-parse.js", "n=100000 method=""whatwg"" type=""multivaluemany""", 207464.48245403994, 0.482010216 "url/legacy-vs-whatwg-url-searchparams-parse.js", "n=100000 method=""legacy"" type=""manypairs""", 101698.05382854801, 0.983302986 "url/legacy-vs-whatwg-url-searchparams-parse.js", "n=100000 method=""whatwg"" type=""manypairs""", 82709.3160806023, 1.209053644 "url/legacy-vs-whatwg-url-searchparams-serialize.js", "n=100000 method=""legacy"" type=""noencode""", 2087508.0885719662, 0.047904006 "url/legacy-vs-whatwg-url-searchparams-serialize.js", "n=100000 method=""whatwg"" type=""noencode""", 957945.566946433, 0.104390065 "url/legacy-vs-whatwg-url-searchparams-serialize.js", "n=100000 method=""legacy"" type=""encodemany""", 2006553.4839406896, 0.049836698 "url/legacy-vs-whatwg-url-searchparams-serialize.js", "n=100000 method=""whatwg"" type=""encodemany""", 955673.9682324034, 0.104638196 "url/legacy-vs-whatwg-url-searchparams-serialize.js", "n=100000 method=""legacy"" type=""encodelast""", 1871094.8496336725, 0.053444645 "url/legacy-vs-whatwg-url-searchparams-serialize.js", "n=100000 method=""whatwg"" type=""encodelast""", 1046005.1145256879, 0.095601827 "url/legacy-vs-whatwg-url-searchparams-serialize.js", "n=100000 method=""legacy"" type=""multivalue""", 1805964.6316274612, 0.05537207 "url/legacy-vs-whatwg-url-searchparams-serialize.js", "n=100000 method=""whatwg"" type=""multivalue""", 1024147.262216766, 0.097642208 "url/legacy-vs-whatwg-url-searchparams-serialize.js", "n=100000 method=""legacy"" type=""multivaluemany""", 984058.1206768975, 0.101620014 "url/legacy-vs-whatwg-url-searchparams-serialize.js", "n=100000 method=""whatwg"" type=""multivaluemany""", 587170.9155831832, 0.170308163 "url/legacy-vs-whatwg-url-searchparams-serialize.js", "n=100000 method=""legacy"" type=""manypairs""", 327120.6759917366, 0.305697583 "url/legacy-vs-whatwg-url-searchparams-serialize.js", "n=100000 method=""whatwg"" type=""manypairs""", 133856.77722659096, 0.747067142 |
After this, it seems url-searchparams-stringifier.js and url-searchparams-parse.js are unneeded and should be removed, since their features can be reproduced with The first commit LGTM. |
|
||
const inputs = { | ||
noencode: 'foo=bar&baz=quux&xyzzy=thud', | ||
encodemany: '%66%6F%6F=bar&%62%61%7A=quux&xyzzy=%74h%75d', |
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.
Any reason why you didn't include multicharsep and encodefake in the benchmark?
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.
URLSearchParams
doesn't support custom separators, so multicharsep
is not needed.
I copied the input from url-searchparams-* benchmarks, looks like there isn't encodefake
in them.
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 see, but I think it's beneficial to have a benchmark case with duplicated &
à la #10454, even w/o custom separators.
4e43765
to
56e4d2c
Compare
Add benchmarks to compare the performance between URLSearchParams and querystring, remove duplicate benchmarks.
@TimothyGu Thanks for the review, I've deleted url-searchparams-stringifier.js and url-searchparams-parse.js and added |
New benchmark results"filename", "configuration", "rate", "time" "url/legacy-vs-whatwg-url-searchparams-parse.js", "n=100000 method=""legacy"" type=""noencode""", 734274.1892019577, 0.136188908 "url/legacy-vs-whatwg-url-searchparams-parse.js", "n=100000 method=""whatwg"" type=""noencode""", 554793.1557187826, 0.180247357 "url/legacy-vs-whatwg-url-searchparams-parse.js", "n=100000 method=""legacy"" type=""encodemany""", 281883.5375670236, 0.354756439 "url/legacy-vs-whatwg-url-searchparams-parse.js", "n=100000 method=""whatwg"" type=""encodemany""", 262448.4441027436, 0.381027216 "url/legacy-vs-whatwg-url-searchparams-parse.js", "n=100000 method=""legacy"" type=""encodefake""", 643062.0908794767, 0.155505979 "url/legacy-vs-whatwg-url-searchparams-parse.js", "n=100000 method=""whatwg"" type=""encodefake""", 483293.1619251652, 0.206913749 "url/legacy-vs-whatwg-url-searchparams-parse.js", "n=100000 method=""legacy"" type=""encodelast""", 510367.36273391626, 0.195937294 "url/legacy-vs-whatwg-url-searchparams-parse.js", "n=100000 method=""whatwg"" type=""encodelast""", 437500.5772273241, 0.228571127 "url/legacy-vs-whatwg-url-searchparams-parse.js", "n=100000 method=""legacy"" type=""multivalue""", 541015.4234083545, 0.184837614 "url/legacy-vs-whatwg-url-searchparams-parse.js", "n=100000 method=""whatwg"" type=""multivalue""", 437601.50823385746, 0.228518408 "url/legacy-vs-whatwg-url-searchparams-parse.js", "n=100000 method=""legacy"" type=""multivaluemany""", 250108.5908974529, 0.39982633 "url/legacy-vs-whatwg-url-searchparams-parse.js", "n=100000 method=""whatwg"" type=""multivaluemany""", 199566.1097502964, 0.501087084 "url/legacy-vs-whatwg-url-searchparams-parse.js", "n=100000 method=""legacy"" type=""manypairs""", 107447.1215269644, 0.930690358 "url/legacy-vs-whatwg-url-searchparams-parse.js", "n=100000 method=""whatwg"" type=""manypairs""", 85509.30339852828, 1.169463392 "url/legacy-vs-whatwg-url-searchparams-serialize.js", "n=100000 method=""legacy"" type=""noencode""", 2154038.526056058, 0.046424425 "url/legacy-vs-whatwg-url-searchparams-serialize.js", "n=100000 method=""whatwg"" type=""noencode""", 991281.4418117199, 0.100879524 "url/legacy-vs-whatwg-url-searchparams-serialize.js", "n=100000 method=""legacy"" type=""encodemany""", 2134596.604680756, 0.046847259 "url/legacy-vs-whatwg-url-searchparams-serialize.js", "n=100000 method=""whatwg"" type=""encodemany""", 972833.6211299463, 0.1027925 "url/legacy-vs-whatwg-url-searchparams-serialize.js", "n=100000 method=""legacy"" type=""encodefake""", 1205527.6335263504, 0.08295123 "url/legacy-vs-whatwg-url-searchparams-serialize.js", "n=100000 method=""whatwg"" type=""encodefake""", 780084.1703018913, 0.128191295 "url/legacy-vs-whatwg-url-searchparams-serialize.js", "n=100000 method=""legacy"" type=""encodelast""", 1735685.898199488, 0.057614111 "url/legacy-vs-whatwg-url-searchparams-serialize.js", "n=100000 method=""whatwg"" type=""encodelast""", 988627.9119911569, 0.10115029 "url/legacy-vs-whatwg-url-searchparams-serialize.js", "n=100000 method=""legacy"" type=""multivalue""", 2106025.583493342, 0.047482804 "url/legacy-vs-whatwg-url-searchparams-serialize.js", "n=100000 method=""whatwg"" type=""multivalue""", 980357.4022317012, 0.102003616 "url/legacy-vs-whatwg-url-searchparams-serialize.js", "n=100000 method=""legacy"" type=""multivaluemany""", 1081755.7575287307, 0.092442309 "url/legacy-vs-whatwg-url-searchparams-serialize.js", "n=100000 method=""whatwg"" type=""multivaluemany""", 610422.7909113565, 0.163820882 "url/legacy-vs-whatwg-url-searchparams-serialize.js", "n=100000 method=""legacy"" type=""manypairs""", 321331.6538998709, 0.311204946 "url/legacy-vs-whatwg-url-searchparams-serialize.js", "n=100000 method=""whatwg"" type=""manypairs""", 124584.44996870444, 0.802668391 |
@TimothyGu Does this LGTY? |
@joyeecheung, I still prefer to have a test case with a disproportionately large number of |
@TimothyGu New cases added, PTAL. Personally I don't find the performance impact on an edge case like this significant though. |
New numbers
|
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. You might find the cases in #11234 interesting, though I'm just fine with landing this as-is.
@TimothyGu I'm planning on unifying the inputs to url-related benchmarks a bit after this. Thanks for the heads up though :) |
PR-URL: #11170 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Add benchmarks to compare the performance between URLSearchParams and querystring, remove duplicate benchmarks. PR-URL: #11170 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Timothy Gu <timothygu99@gmail.com>
PR-URL: nodejs#11170 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Add benchmarks to compare the performance between URLSearchParams and querystring, remove duplicate benchmarks. PR-URL: nodejs#11170 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Timothy Gu <timothygu99@gmail.com>
PR-URL: nodejs#11170 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Add benchmarks to compare the performance between URLSearchParams and querystring, remove duplicate benchmarks. PR-URL: nodejs#11170 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Timothy Gu <timothygu99@gmail.com>
PR-URL: nodejs#11170 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Add benchmarks to compare the performance between URLSearchParams and querystring, remove duplicate benchmarks. PR-URL: nodejs#11170 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Timothy Gu <timothygu99@gmail.com>
This PR is a follow-up of #10678, which compare the performance of
URLSearchParams
toquerystring
counterparts.Also it fixes a mistake in
legacy-vs-whatwg-url-parse.js
where the first call tonew URL
was written asurl.parse
.Refs: #10874 (comment)
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)
benchmark, url