GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — url: improve invalid url performance by anonrig · Pull Request #49692 · nodejs/node

Conversation

@anonrig

@anonrig anonrig commented Sep 17, 2023 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Some easy wins for Invalid URL path.

                                                    confidence improvement accuracy (*)   (**)  (***)
url/whatwg-url-validity.js e=100000 type='invalid'        ***    120.33 %       ±2.06% ±2.74% ±3.56%
url/whatwg-url-validity.js e=100000 type='valid'                   1.35 %       ±2.21% ±2.96% ±3.91%

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 (***)

cc @nodejs/url @nodejs/performance

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

H4ad, bricss, aydgn, Marcisbee, theoludwig, MomenNano, gurgunday, and mertcanaltin reacted with rocket emoji
All reactions
  • 🚀 8 reactions
@anonrig anonrig added performance Issues and PRs related to the performance of Node.js. whatwg-url Issues and PRs related to the WHATWG URL implementation. labels Sep 17, 2023
@nodejs-github-bot

nodejs-github-bot commented Sep 17, 2023

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/url
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@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. labels Sep 17, 2023
@anonrig
anonrig force-pushed the improve-invalid-url-performance branch from 0501c68 to 79415ed Compare September 17, 2023 21:36
@anonrig anonrig added the semver-major PRs that contain breaking changes and should be released in the next major version. label Sep 17, 2023
@anonrig

anonrig commented Sep 17, 2023

Copy link
Copy Markdown
Member Author

@nodejs/tsc I've removed the error.input from URL error - ERR_INVALID_URL to make sure we share a similar output with Chrome and Safari. I've also added semver-major label because of the removal of error.input attribute.

Safari returns: TypeError: Type error
Chrome returns: VM78:1 Uncaught TypeError: Failed to construct 'URL': Invalid URL

None of them have the error.input attribute.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@aduh95

aduh95 commented Sep 17, 2023

Copy link
Copy Markdown
Contributor

I would keep the input, and even add the base, it can very hard to understand what is the error without seeing the input and base

tniessen and BridgeAR reacted with thumbs up emoji tonivj5 reacted with eyes emoji
All reactions
  • 👍 2 reactions
  • 👀 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Uzlopak
Uzlopak reviewed Sep 17, 2023
View reviewed changes
Comment thread lib/internal/errors.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

@rluvaton rluvaton added the needs-benchmark-ci PRs that need a benchmark CI run. label Sep 18, 2023
@rluvaton

rluvaton commented Sep 18, 2023

Copy link
Copy Markdown
Member

Benchmark CI:
https://ci.nodejs.org/view/Node.js%20benchmark/job/benchmark-node-micro-benchmarks/1396/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

mcollina
mcollina approved these changes Sep 18, 2023
View reviewed changes

@mcollina mcollina left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

lgtm

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
ronag
ronag approved these changes Sep 18, 2023
View reviewed changes
@aduh95

aduh95 commented Sep 18, 2023

Copy link
Copy Markdown
Contributor

Could there be a way to get the same performance improvements without removing helpful debugging information? If not, maybe we could use a flag to opt-in to the slower option that outputs the input and base?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@anonrig

anonrig commented Sep 18, 2023

Copy link
Copy Markdown
Member Author

Could there be a way to get the same performance improvements without removing helpful debugging information? If not, maybe we could use a flag to opt-in to the slower option that outputs the input and base?

Probably, although I'm not sure. This requires a similar approach to what ThrowAccessDenied is doing in https://github.com/nodejs/node/blob/main/src/permission/permission.cc#L102.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@anonrig anonrig added the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Sep 18, 2023
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Sep 18, 2023
@nodejs-github-bot

nodejs-github-bot commented Sep 18, 2023

Copy link
Copy Markdown
Collaborator

CI: https://ci.nodejs.org/job/node-test-pull-request/54043/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@nodejs-github-bot

nodejs-github-bot commented Sep 18, 2023

Copy link
Copy Markdown
Collaborator

CI: https://ci.nodejs.org/job/node-test-pull-request/54047/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@tniessen

tniessen commented Sep 19, 2023

Copy link
Copy Markdown
Member

FWIW, I tend to agree with @aduh95 that removing error information for the sake of performance (on an error path!) does not benefit users. I thought that URL.canParse() was specifically added to avoid having to rely on the performance of the URL error path.

BridgeAR reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Uzlopak

Uzlopak commented Sep 19, 2023

Copy link
Copy Markdown
Contributor

How much is actually the performance hit when keeping the input as an attribute?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

BridgeAR
BridgeAR previously requested changes Sep 19, 2023
View reviewed changes

@BridgeAR BridgeAR left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

I do not think it's a good idea to remove important debug information in favor of performance. We can definitely improve the performance but debug information is more important. I had an open PR to improve the situation a lot and I have to get back to that again.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@anonrig
anonrig force-pushed the improve-invalid-url-performance branch from 147dd75 to a9c408a Compare September 19, 2023 22:30
@anonrig

anonrig commented Sep 19, 2023

Copy link
Copy Markdown
Member Author

@BridgeAR @aduh95 @tniessen I've updated the implementation. Previously this pull request was 142% faster than main. Right now it is 120% faster. I also added base field to the error object.

Appreciate it, if you can review it once again.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@anonrig
anonrig force-pushed the improve-invalid-url-performance branch from a9c408a to 29267d9 Compare September 19, 2023 22:32
@anonrig
anonrig requested a review from BridgeAR September 19, 2023 22:33
@anonrig
url: improve invalid url performance
c59b136
@anonrig
anonrig force-pushed the improve-invalid-url-performance branch from 29267d9 to c59b136 Compare September 19, 2023 22:38
@anonrig anonrig added the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Sep 20, 2023
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Sep 20, 2023
@nodejs-github-bot

nodejs-github-bot commented Sep 20, 2023

Copy link
Copy Markdown
Collaborator

CI: https://ci.nodejs.org/job/node-test-pull-request/54072/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@nodejs-github-bot

nodejs-github-bot commented Sep 20, 2023

Copy link
Copy Markdown
Collaborator

CI: https://ci.nodejs.org/job/node-test-pull-request/54088/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@nodejs-github-bot

nodejs-github-bot commented Sep 20, 2023

Copy link
Copy Markdown
Collaborator

CI: https://ci.nodejs.org/job/node-test-pull-request/54099/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot mentioned this pull request Sep 21, 2023
CI Reliability 2023-09-21 nodejs/reliability#672
Open
22 tasks
@nodejs-github-bot

nodejs-github-bot commented Sep 21, 2023

Copy link
Copy Markdown
Collaborator

CI: https://ci.nodejs.org/job/node-test-pull-request/54128/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot mentioned this pull request Sep 22, 2023
CI Reliability 2023-09-22 nodejs/reliability#673
Open
17 tasks
@anonrig

anonrig commented Sep 22, 2023

Copy link
Copy Markdown
Member Author

Hey @BridgeAR, can you re-review this pull request, and remove your block?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot mentioned this pull request Sep 23, 2023
CI Reliability 2023-09-23 nodejs/reliability#674
Open
16 tasks
@benjamingr

benjamingr commented Sep 23, 2023

Copy link
Copy Markdown
Member

I suspect he would still object since the URL isn't part of the message string, what's the cost of adding that back?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@anonrig

anonrig commented Sep 23, 2023 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member Author

I suspect he would still object since the URL isn't part of the message string, what's the cost of adding that back?

I don't follow. URL was never part of the message string? Input is a property of the error object. On top of that I've also added base property to the error as well.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@benjamingr

benjamingr commented Sep 23, 2023

Copy link
Copy Markdown
Member

@anonrig ah, I'm probably mixing it up with another PR then, lgtm

anonrig reacted with heart emoji
All reactions
  • ❤️ 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

benjamingr
benjamingr approved these changes Sep 23, 2023
View reviewed changes
@github-actions github-actions Bot mentioned this pull request Sep 24, 2023
CI Reliability 2023-09-24 nodejs/reliability#675
Open
20 tasks
@anonrig anonrig added the tsc-agenda Issues and PRs to discuss during Technical Steering Committee meetings. label Sep 26, 2023
@anonrig

anonrig commented Sep 26, 2023

Copy link
Copy Markdown
Member Author

Adding to @nodejs/tsc agenda to resolve the block.

mertcanaltin reacted with heart emoji
All reactions
  • ❤️ 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@targos

targos commented Sep 26, 2023

Copy link
Copy Markdown
Member

There's no need for the TSC to intervene if you addressed the blocking comment

cjihrig and Uzlopak reacted with thumbs up emoji
All reactions
  • 👍 2 reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@anonrig
anonrig dismissed BridgeAR’s stale review September 26, 2023 15:32

The comment is addressed.

@anonrig anonrig added commit-queue PRs queued for automated landing through the Commit Queue. and removed tsc-agenda Issues and PRs to discuss during Technical Steering Committee meetings. labels Sep 26, 2023
@nodejs-github-bot nodejs-github-bot removed the commit-queue PRs queued for automated landing through the Commit Queue. label Sep 26, 2023
@nodejs-github-bot
nodejs-github-bot merged commit c829c03 into nodejs:main Sep 26, 2023
@nodejs-github-bot

nodejs-github-bot commented Sep 26, 2023

Copy link
Copy Markdown
Collaborator

Landed in c829c03

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

ruyadorno pushed a commit that referenced this pull request Sep 28, 2023
@anonrig @ruyadorno
url: improve invalid url performance
7d91a73
PR-URL: #49692
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Robert Nagy <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
@ruyadorno ruyadorno mentioned this pull request Sep 28, 2023
v20.7.1 proposal #49917
Closed
ruyadorno pushed a commit that referenced this pull request Sep 28, 2023
@anonrig @ruyadorno
url: improve invalid url performance
097b598
PR-URL: #49692
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Robert Nagy <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
@ruyadorno ruyadorno mentioned this pull request Sep 28, 2023
v20.8.0 proposal #49932
Merged
debadree25 pushed a commit to debadree25/node that referenced this pull request Apr 15, 2024
@anonrig @debadree25
url: improve invalid url performance
5eb1cd2
PR-URL: nodejs#49692
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Robert Nagy <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
@coderabbitai coderabbitai Bot mentioned this pull request Aug 5, 2026
feat(clickhouse): wire the statement limiter, one client, one door langwatch/langwatch#6614
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@mcollina mcollina mcollina approved these changes
@benjamingr benjamingr benjamingr approved these changes
@ronag ronag ronag approved these changes
@BridgeAR BridgeAR Awaiting requested review from BridgeAR
+1 more reviewer
@Uzlopak Uzlopak Uzlopak left review comments
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

c++ Issues and PRs that require attention from people who are familiar with C++. needs-benchmark-ci PRs that need a benchmark CI run. needs-ci PRs that need a full CI run. performance Issues and PRs related to the performance of Node.js. whatwg-url Issues and PRs related to the WHATWG URL implementation.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

11 participants

@anonrig @nodejs-github-bot @aduh95 @rluvaton @tniessen @Uzlopak @benjamingr @targos @mcollina @ronag @BridgeAR
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.