-
Notifications
You must be signed in to change notification settings - Fork 30.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
esm: avoid accessing lazy getters for urls #47542
Conversation
Review requested:
|
bb4b123
to
8661421
Compare
And I guess that we don’t expose the protocole type as an integer to JavaScript? If we did, we could avoid string comparisons. |
That's a really good argument @lemire. I'll look for some alternatives after this pull request, to improve it even more. |
I would expect that if you have several instances of the protocol string in JavaScript, that would be a performance penalty irrespective of the backend. Having just one reference is better. |
Landed in 93e550a |
PR-URL: #47542 Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Stephen Belanger <[email protected]> Reviewed-By: Jacob Smith <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
PR-URL: #47542 Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Stephen Belanger <[email protected]> Reviewed-By: Jacob Smith <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
PR-URL: nodejs#47542 Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Stephen Belanger <[email protected]> Reviewed-By: Jacob Smith <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
This pull request avoids multiple calls to the
protocol
getter of the URL. Previor to Ada version 2,url.protocol
was always returned an already allocated string, but right now, it slices a new string for each call. Storing it in a variable and access it, would make some improvement in terms of performance.cc @nodejs/url