FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

deps: replace url parser with Ada by anonrig · Pull Request #46410 · nodejs/node · GitHub

/ node Public

deps: replace url parser with Ada - #46410

Closed
anonrig wants to merge 2 commits into
nodejs:mainfrom
anonrig:deps/ada
Closed

deps: replace url parser with Ada#46410
anonrig wants to merge 2 commits into
nodejs:mainfrom
anonrig:deps/ada

Conversation

anonrig commented Jan 29, 2023
edited
Loading

Copy link
Copy Markdown
Member

This work was done in collaboration with me, @miguelteixeiraa and @lemire. I would also like to thank @addaleax and @ronag for their help.

This pull request replaces the existing URL parser with Ada, a fast spec-compliant URL parser written from scratch using modern C++ focused on performance.

A little bit about Ada:

  • 100% spec compliant (even has its own WPT updater, which led us to find a couple of errors in WPT)
  • Fully tested (using both web platform tests, custom tests not covered by WPT) on Big Endian Systems (s390x), Ubuntu 20.04, Ubuntu 22.04 (with G++ and Clang++), Windows VS 2022 (with and without ClangCL)
  • Well documented and available for the public at https://ada-url.github.io/ada
  • On typical URLs, we use between 50 and 60 instructors per input byte for fully parsing and validating a URL string into a URL data structure.

The possibilities with this pull request:

Side Note: Current benchmarks show up to 87% faster URL parsing, with similar but sometimes faster execution speeds compared to url.parse.

Fixes #46332
Fixes #46063
Fixes #30334
Fixes #44476
Fixes nodejs/performance#33
Closes #41220

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/crypto
  • @nodejs/gyp
  • @nodejs/loaders
  • @nodejs/modules
  • @nodejs/node-api
  • @nodejs/tsc
  • @nodejs/vm

nodejs-github-bot added lib / src Issues and PRs related to general changes in the lib or src directory. needs-ci PRs that need a full CI run. labels Jan 29, 2023
anonrig force-pushed the deps/ada branch 9 times, most recently from 8f4d1a4 to 4a68c84 Compare January 30, 2023 02:37

mcollina left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Something that I think should be experimented upon is to avoid copying all data back-and-forth every time a field is updated.

Maybe it might be better to fetch them from C++ every time they are accessed, or possibly use tricks to use the V8 fast API.

anonrig force-pushed the deps/ada branch 3 times, most recently from 21adb01 to 6f070dc Compare January 30, 2023 17:28

Copy link
Copy Markdown
Member

Deprecating url.parse

I think that has always been possible, with or without Ada? It's kept for compatibility reasons, not performance.

Removes the need to update and conform to URL WPT

We probably still want to run the JS tests to make sure that the JS glues work properly

anonrig commented Jan 30, 2023

Copy link
Copy Markdown
Member Author

We probably still want to run the JS tests to make sure that the JS glues work properly

You're right. This pull request does not remove them.

anonrig force-pushed the deps/ada branch 2 times, most recently from 5e1e1ac to a1c7401 Compare January 30, 2023 20:35

anonrig commented Jan 30, 2023

Copy link
Copy Markdown
Member Author

test/sequential/test-inspector.js test is failing. Appreciate any help in pinpointing why it causes timeouts. cc @targos @Trott @addaleax (according to git blame, you were the only ones who worked on this file in the last 3 years)

MoLow commented Jan 30, 2023

Copy link
Copy Markdown
Member

@anonrig it might very well be related to parsing the debugger websocket url

anonrig force-pushed the deps/ada branch 5 times, most recently from eb45d67 to 17d3ed7 Compare February 1, 2023 19:14

Copy link
Copy Markdown
Member

I see right now Ada has Windows-specific IDNA handling using IdnToAscii. I'm a little concerned about this, as it would introduce platform-dependent URL parsing results. I also doubt Windows's IdnToAscii implements UTS46 fully.

I see plans to switch to an internal implementation (ada-url/ada#89) which would alleviate my concern. Do note though, that there are (still) outstanding issues with UTS46 on the spec side (see whatwg/url#744).

(Context: I helped create the previous WHATWG URL parser, and also maintain https://github.com/jsdom/tr46.)

lemire commented Feb 1, 2023
edited
Loading

Copy link
Copy Markdown
Member

I see right now Ada has Windows-specific IDNA handling using IdnToAscii.

When ICU is unavailable and we are under Windows, then ada falls back on Windows functions. That is correct.

Wherever we are, if ICU is available, we rely on ICU.

Copy link
Copy Markdown
Collaborator

Landed in 4c08c20...c4581ab

nodejs-github-bot pushed a commit that referenced this pull request Feb 6, 2023
PR-URL: #46410
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: Robert Nagy <ronagy@icloud.com>
nodejs-github-bot pushed a commit that referenced this pull request Feb 6, 2023
PR-URL: #46410
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: Robert Nagy <ronagy@icloud.com>
richardlau added the baking-for-lts PRs that need to wait before landing in a LTS release. label Feb 6, 2023

Copy link
Copy Markdown
Member

@nodejs/lts I've put baking-for-lts PRs that need to wait before landing in a LTS release. on this -- I feel we should err on the side of caution and allow more time for this in current releases before considering for LTS.

tniessen added a commit to tniessen/node that referenced this pull request Feb 7, 2023
MylesBorins pushed a commit that referenced this pull request Feb 18, 2023
PR-URL: #46410
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: Robert Nagy <ronagy@icloud.com>
MylesBorins mentioned this pull request Feb 19, 2023
zloirock mentioned this pull request Feb 21, 2023

anonrig commented Mar 22, 2023

Copy link
Copy Markdown
Member Author

@nodejs/lts I've put baking-for-lts PRs that need to wait before landing in a LTS release. on this -- I feel we should err on the side of caution and allow more time for this in current releases before considering for LTS.

@richardlau Should we remove the backing-for-lts label? In total, there were 2 issues reported and all of them is fixed in 19.8.0.

Copy link
Copy Markdown
Member

@nodejs/lts I've put baking-for-lts PRs that need to wait before landing in a LTS release. on this -- I feel we should err on the side of caution and allow more time for this in current releases before considering for LTS.

@richardlau Should we remove the backing-for-lts label? In total, there were 2 issues reported and all of them is fixed in 19.8.0.

@nodejs/lts thoughts?

targos commented Mar 22, 2023

Copy link
Copy Markdown
Member

I'd be ok for a backport to active v18.x, not earlier.

Copy link
Copy Markdown
Contributor

@anonrig this will need a backport to v18.x.

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author ready PRs that have at least one approval, no outstanding review comments, and a CI started. commit-queue-rebase Add this label to allow the Commit Queue to land a PR in several commits. lib / src Issues and PRs related to general changes in the lib or src directory. needs-ci PRs that need a full CI run. notable-change PRs with changes that should be highlighted in changelogs. review wanted PRs that need reviews.

Projects

None yet

Back | FazBrowse Home | New Git URL