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

url: simplify and improve url formatting by anonrig · Pull Request #46736 · nodejs/node · GitHub

/ node Public

url: simplify and improve url formatting - #46736

Merged
nodejs-github-bot merged 1 commit into
nodejs:mainfrom
anonrig:improve-url-parsing
Feb 24, 2023
Merged

url: simplify and improve url formatting#46736
nodejs-github-bot merged 1 commit into
nodejs:mainfrom
anonrig:improve-url-parsing

Conversation

anonrig commented Feb 19, 2023
edited
Loading

Copy link
Copy Markdown
Member

This pull request separates the logic of kFormat and URL and moves the logic to C++.

Quick summary:

  • Move Url.format implementation to C++ where it directly calls Ada. This is done to avoid having any URL logic inside Node.js
  • Call search setter whenever searchParams is changed, instead of calculating href on the JS layer. This was done to remove any URL logic inside Node.js.
  • Remove kFormat since it isn't used anymore after step 1 and 2.
  • Remove hasOpaquePath and hasHost from URL, since it was only needed for kFormat and searchParams setter.
  • Ise ToStringView() and ToString() methods that @addaleax recommended.

cc @nodejs/url @nodejs/cpp-reviewers

nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. url Issues and PRs related to the legacy built-in url module. whatwg-url Issues and PRs related to the WHATWG URL implementation. labels Feb 19, 2023
anonrig force-pushed the improve-url-parsing branch from 2e032a0 to 4c6bdff Compare February 19, 2023 19:13
anonrig added the request-ci Add this label to start a Jenkins CI on a PR. label Feb 19, 2023
github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Feb 19, 2023

Copy link
Copy Markdown
Collaborator

Comment thread src/node_url.cc Outdated

Copy link
Copy Markdown
Collaborator

Copy link
Copy Markdown
Collaborator

Copy link
Copy Markdown
Collaborator

Copy link
Copy Markdown
Collaborator

Copy link
Copy Markdown
Member

Is this for better performance?

anonrig commented Feb 20, 2023

Copy link
Copy Markdown
Member Author

Is this for better performance?

Not for this specifically, but I'm preparing for the new Ada changes where we will focus on enabling node.js-specific APIs to improve the performance. This is mainly for removing the URL parsing logic from Node.js core, and moving it to C++/Ada.

anonrig added the review wanted PRs that need reviews. label Feb 20, 2023
anonrig requested review from TimothyGu and jasnell February 20, 2023 17:16

Copy link
Copy Markdown
Collaborator

anonrig requested a review from addaleax February 20, 2023 18:52
anonrig force-pushed the improve-url-parsing branch from 4c6bdff to c8f6c5a Compare February 20, 2023 23:03
anonrig added the request-ci Add this label to start a Jenkins CI on a PR. label Feb 20, 2023
github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Feb 20, 2023

Copy link
Copy Markdown
Collaborator

Copy link
Copy Markdown
Collaborator

Comment thread lib/url.js Outdated
Comment thread lib/internal/url.js Outdated
anonrig added the commit-queue Add this label to land a pull request using GitHub Actions. label Feb 24, 2023
nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Feb 24, 2023
nodejs-github-bot merged commit 8073392 into nodejs:main Feb 24, 2023

Copy link
Copy Markdown
Collaborator

Landed in 8073392

anonrig deleted the improve-url-parsing branch February 24, 2023 22:35
targos pushed a commit that referenced this pull request Mar 13, 2023
PR-URL: #46736
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>

Copy link
Copy Markdown
Contributor

@anonrig this broke the build when landing in v18.x. Do you mind creating a backport PR?

anonrig commented Apr 5, 2023

Copy link
Copy Markdown
Member Author

This depends on #46723

anonrig added a commit to anonrig/node that referenced this pull request Apr 11, 2023
PR-URL: nodejs#46736
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
danielleadams pushed a commit that referenced this pull request Apr 12, 2023
PR-URL: #46736
Backport-PR-URL: #47435
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
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

c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. review wanted PRs that need reviews. 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.

7 participants


Back | FazBrowse Home | New Git URL