You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Doesn't this just require someone to do some performance work on Node's URL implementation? I can't speak to Bun at all, but Deno has people that spend all (or most) of their time improving performance of things like this.
Yeah, the implementation was written to be spec compliant, not performant. Just needs some attention from folks who want to work on the performance tuning.
Reacted by Benjamin Gruenbaum, Carlos Fuentes and Steven
$ node benchmark/compare.js --old ~/.nvs/node/14.21.1/x64/bin/node --new ./node_main --filter url-parse --set method=whatwg --set type=wpt url > out.csv
$ node-benchmark-compare out.csv
confidence improvement accuracy (*) (**) (***)
url/legacy-vs-whatwg-url-parse.js method='whatwg' e=1 type='wpt' withBase='false' *** -40.63 % ±3.07% ±4.09% ±5.32%
url/legacy-vs-whatwg-url-parse.js method='whatwg' e=1 type='wpt' withBase='true' *** 10.59 % ±4.53% ±6.02% ±7.84%
Be aware that when doing many comparisons the risk of a false-positive result increases.
In this case, there are 2 comparisons, you can thus expect the following amount of false-positive results:
0.10 false positives, when considering a 5% risk acceptance (*, **, ***),
0.02 false positives, when considering a 1% risk acceptance (**, ***),
0.00 false positives, when considering a 0.1% risk acceptance (***)
I'd also suggest that we need to be careful about micro-benchmarking the URL constructor using a constant input (e.g. our type=wpt benchmarks go to some lengths to make sure that the result is meaningful, and the input comes from the WPT test data set). There are a lot of factors that can affect the numbers (e.g. if you don't even use the returned result v8 might just fold things and you'd be comparing between noops and actually doing anything). So sheer numbers are not very meaningful when it's not clear if the benchmarks are written in the same and a proper way.
Reacted by Rich Trott, Benjamin Gruenbaum, Ulises Gascón, Carlos Fuentes and Jean Burellier
Activity
anonrig commentedon Dec 15, 2022
My local benchmark result for
new URL('http://example.com'):Trott commentedon Dec 15, 2022
Maybe @cjihrig or @bnoordhuis could offer some information/advice on how to approach this.
anonrig commentedon Dec 15, 2022
Deno uses a smart way of just returning the start and end points for the states from native side: https://github.com/denoland/deno/blob/0d4e4af7acf82c1365999a7281910daa05f0e982/ext/url/lib.rs#L100
cjihrig commentedon Dec 15, 2022
Doesn't this just require someone to do some performance work on Node's URL implementation? I can't speak to Bun at all, but Deno has people that spend all (or most) of their time improving performance of things like this.
jasnell commentedon Dec 15, 2022
Yeah, the implementation was written to be spec compliant, not performant. Just needs some attention from folks who want to work on the performance tuning.
joyeecheung commentedon Dec 15, 2022
We can maybe start from not regressing:
I'd also suggest that we need to be careful about micro-benchmarking the URL constructor using a constant input (e.g. our type=wpt benchmarks go to some lengths to make sure that the result is meaningful, and the input comes from the WPT test data set). There are a lot of factors that can affect the numbers (e.g. if you don't even use the returned result v8 might just fold things and you'd be comparing between noops and actually doing anything). So sheer numbers are not very meaningful when it's not clear if the benchmarks are written in the same and a proper way.
anonrig commentedon Jan 16, 2023
I'm working on this, and writing a new URL parser (available but work-in-progress at https://github.com/ada-url/ada)
tony-go commentedon Jan 18, 2023
ADA is neat ^^
anonrig commentedon Jan 23, 2023
A quick update referencing the benchmark that leads to this issue. For parsing the URL
http://example.com,Ada takes 105ns.anonrig commentedon Jan 29, 2023
Progress update on Ada: Right now,
new URLis as fast asurl.parsemarvinhagemeister commentedon Jan 30, 2023
Very happy to see this! The performance of
new URLdirectly relates to module resolution too, when node is run in ESM mode.