Skip to content

Conversation

@anonrig
Copy link
Member

@anonriganonrig commented Feb 19, 2023

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-botnodejs-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
@anonriganonrig added the request-ci Add this label to start a Jenkins CI on a PR. label Feb 19, 2023
@github-actionsgithub-actionsbot removed the request-ci Add this label to start a Jenkins CI on a PR. label Feb 19, 2023
@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@RaisinTen
Copy link
Member

Is this for better performance?

@anonrig
Copy link
MemberAuthor

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.

@anonriganonrig added the review wanted PRs that need reviews. label Feb 20, 2023
@nodejs-github-bot
Copy link
Collaborator

@anonriganonrig added the request-ci Add this label to start a Jenkins CI on a PR. label Feb 20, 2023
@github-actionsgithub-actionsbot removed the request-ci Add this label to start a Jenkins CI on a PR. label Feb 20, 2023
@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@anonriganonrig added the commit-queue Add this label to land a pull request using GitHub Actions. label Feb 24, 2023
@nodejs-github-botnodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Feb 24, 2023
@nodejs-github-botnodejs-github-bot merged commit 8073392 into nodejs:mainFeb 24, 2023
@nodejs-github-bot
Copy link
Collaborator

Landed in 8073392

@anonriganonrig 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 <[email protected]> Reviewed-By: James M Snell <[email protected]>
@targostargos mentioned this pull request Mar 14, 2023
@danielleadams
Copy link
Contributor

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

@anonrig
Copy link
MemberAuthor

This depends on #46723

anonrig added a commit to anonrig/node that referenced this pull request Apr 6, 2023
PR-URL: nodejs#46736 Reviewed-By: Tiancheng "Timothy" Gu <[email protected]> Reviewed-By: James M Snell <[email protected]>
anonrig added a commit to anonrig/node that referenced this pull request Apr 11, 2023
PR-URL: nodejs#46736 Reviewed-By: Tiancheng "Timothy" Gu <[email protected]> Reviewed-By: James M Snell <[email protected]>
anonrig added a commit to anonrig/node that referenced this pull request Apr 11, 2023
PR-URL: nodejs#46736 Reviewed-By: Tiancheng "Timothy" Gu <[email protected]> Reviewed-By: James M Snell <[email protected]>
danielleadams pushed a commit that referenced this pull request Apr 12, 2023
PR-URL: #46736 Backport-PR-URL: #47435 Reviewed-By: Tiancheng "Timothy" Gu <[email protected]> Reviewed-By: James M Snell <[email protected]>
Sign up for freeto 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-ciPRs that need a full CI run.review wantedPRs that need reviews.urlIssues and PRs related to the legacy built-in url module.whatwg-urlIssues and PRs related to the WHATWG URL implementation.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants

@anonrig@nodejs-github-bot@RaisinTen@danielleadams@jasnell@addaleax@TimothyGu