| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
Review requested:
|
Sorry, something went wrong.
There was a problem hiding this comment.
Given that URL.canParse is user-mutable, should we use const { canParse } = URL or something like that? Or even better, can we import it primordial-style from ada directly?
Sorry, something went wrong.
@aduh95 I like where this is going, but I couldn't visualize it. Can you elaborate on how we can import it primordial-style? We can always do const { canParse } = internalBinding('url'); if that's what you are recommending? |
Sorry, something went wrong.
|
Yes, I mean something that's available only internally and cannot be mutated at runtime. const { canParse } = internalBinding('url') is close enough, let's roll with this :) |
Sorry, something went wrong.
Sorry, something went wrong.
|
This is way better/cleaner :-) but does it prevent backporting this commit, since older release lines may not have URL.canParse? |
Sorry, something went wrong.
It might make it harder, due to conflicts, but I don't think it will block backporting any future changes to ESM. |
Sorry, something went wrong.
|
oh sure, i just meant, should this PR have any "do not backport" labels, or link to the canParse PR as a prereq? |
Sorry, something went wrong.
I'm not quite sure. @nodejs/releasers what do you recommend? |
Sorry, something went wrong.
There was a problem hiding this comment.
Sweet, thanks! I was just suggesting this change last night in Slack 😁
Sorry, something went wrong.
canParse was added in #47179, and there's no labels that says the backport is blocked, so no action should be necessary here I think. PRs are backported in the order they landed on Current release lines, precisely because it's often the case that a PR builds on top of another one. |
Sorry, something went wrong.
I'm confused by this. The C++ API still says this: Lines 116 to 117 in 4afb25c Or did you actually mean this PR does not improve performance until the TODO is resolved? |
Sorry, something went wrong.
I was giving some context to this particular change. It is definitely faster than the current implementation. Additionally, @KhafraDev just opened a pull request for adding v8 fast API to canParse #47552 |
Sorry, something went wrong.
|
@aduh95 perfect, thanks for clarifying and linking :-) |
Sorry, something went wrong.
Sorry, something went wrong.
Sorry, something went wrong.
|
Would someone re-review this pull request? It's required due to force-push. |
Sorry, something went wrong.
| } = require('internal/errors').codes; | ||
| const { exitCodes: { kUnfinishedTopLevelAwait } } = internalBinding('errors'); | ||
| const { URL } = require('internal/url'); | ||
| const { canParse: urlCanParse } = internalBinding('url'); |
There was a problem hiding this comment.
nit: this sounds a little Yoda-esque
| const { canParse: urlCanParse } = internalBinding('url'); | |
| const { canParse: canParseURL } = internalBinding('url'); |
Sorry, something went wrong.
There was a problem hiding this comment.
Not sure this is better, isURLString might be more suited. URLCanParse has the upside of being consistent with how primordials are named, which is nice imho
Sorry, something went wrong.
There was a problem hiding this comment.
I want to change this to URLCanParse too but I'm too demotivated by having to run Node.js CI multiple times because of the flaky tests.
Sorry, something went wrong.
PR-URL: #47541 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Jacob Smith <jacob@frende.me> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
PR-URL: nodejs#47541 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Jacob Smith <jacob@frende.me> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
PR-URL: nodejs/node#47541 Backport-PR-URL: nodejs/node#50669 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Jacob Smith <jacob@frende.me> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
PR-URL: nodejs/node#47541 Backport-PR-URL: nodejs/node#50669 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Jacob Smith <jacob@frende.me> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
| Back | FazBrowse Home | New Git URL |
Due to URL.canParse, we can avoid try/catch block and have faster validation. The previous implementation was not performant due to:
cc @nodejs/url