Skip to content

Conversation

anonrig
Copy link
Member

@anonrig anonrig 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-bot 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 anonrig force-pushed the improve-url-parsing branch from 2e032a0 to 4c6bdff Compare February 19, 2023 19:13
@anonrig anonrig added the request-ci Add this label to start a Jenkins CI on a PR. label Feb 19, 2023
@github-actions github-actions bot 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
Member Author

anonrig commented Feb 20, 2023

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 anonrig added the review wanted PRs that need reviews. label Feb 20, 2023
@anonrig anonrig requested review from TimothyGu and jasnell February 20, 2023 17:16
@nodejs-github-bot
Copy link
Collaborator

@anonrig anonrig requested a review from addaleax February 20, 2023 18:52
@anonrig anonrig force-pushed the improve-url-parsing branch from 4c6bdff to c8f6c5a Compare February 20, 2023 23:03
@anonrig anonrig added the request-ci Add this label to start a Jenkins CI on a PR. label Feb 20, 2023
@github-actions github-actions bot 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

@anonrig anonrig added the commit-queue Add this label to land a pull request using GitHub Actions. label Feb 24, 2023
@nodejs-github-bot 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 nodejs-github-bot merged commit 8073392 into nodejs:main Feb 24, 2023
@nodejs-github-bot
Copy link
Collaborator

Landed in 8073392

@anonrig 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 <[email protected]>
Reviewed-By: James M Snell <[email protected]>
@danielleadams
Copy link
Contributor

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

@anonrig
Copy link
Member Author

anonrig commented Apr 5, 2023

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 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