-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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
lib: reduce url getters on makeRequireFunction
#48492
Conversation
Review requested:
|
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.
Thank you for this!
I gather from this and related PRs that URL objects in general are more costly than primitive strings? Should we make an effort to try to scrub the modules code of URL objects whenever possible, converting to strings instead?
@GeoffreyBooth URL object is not costly, but accessing their attributes except |
I would think it should be possible to “cache” |
This might be an (micro)-optimization worth investigating for, but adding a branch and accessing the cache parameter overhead might be greater than just simply reduce calling it. I simply don't have the data right now to back the claim if one approach is better than another. |
667228f
to
1081b87
Compare
Rebased and force-pushed. |
Landed in 578ffe1 |
PR-URL: #48492 Refs: nodejs/performance#92 Reviewed-By: Jacob Smith <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Geoffrey Booth <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: James M Snell <[email protected]>
PR-URL: nodejs#48492 Refs: nodejs/performance#92 Reviewed-By: Jacob Smith <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Geoffrey Booth <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: James M Snell <[email protected]>
PR-URL: nodejs#48492 Refs: nodejs/performance#92 Reviewed-By: Jacob Smith <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Geoffrey Booth <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: James M Snell <[email protected]>
PR-URL: #48492 Refs: nodejs/performance#92 Reviewed-By: Jacob Smith <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Geoffrey Booth <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: James M Snell <[email protected]>
PR-URL: #48492 Refs: nodejs/performance#92 Reviewed-By: Jacob Smith <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Geoffrey Booth <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: James M Snell <[email protected]>
Reduce calling getters of URL due to the lazy loading of URL.
Ref: nodejs/performance#92