-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
url: fix performance regression #39778
Conversation
This comment has been minimized.
This comment has been minimized.
@@ -626,7 +626,7 @@ function onParseHashComplete(flags, protocol, username, password, | |||
} | |||
|
|||
function isURLThis(self) { | |||
return self?.[context] !== undefined; | |||
return (self !== undefined && self !== null && self[context] !== undefined); |
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.
return (self !== undefined && self !== null && self[context] !== undefined); | |
return self != null && self[context] !== undefined; |
Isn't this faster, or at least equivalent?
or like isURLSearchParams
?
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.
this is fascinating to me, as these two lines of code should generate identical graph representations
PR-URL: #39778 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Gus Caplan <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Gerhard Stöbich <[email protected]>
Landed in f581f6d. |
This (mostly) fixes a performance regression introduced in e1e669b. While this PR does help, it doesn't completely restore performance levels pre- e1e669b but it's fairly close.
Example benchmark results:
/cc @jasnell