-
Notifications
You must be signed in to change notification settings - Fork 30.3k
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: remove proxy for builtin exports #29737
Conversation
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.
Thanks so much for getting to this one. As discussed in the last meeting this seems a great way to avoid any potential perf issues from the proxies.
We should probably include a documentation note on the syncESMExports
API in module.md.
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 think this is great! Thanks for working on it. It looks pretty close to something we can ship as-is, one minor bikeshed on "sync all" method name aside.
lib/internal/bootstrap/loaders.js
Outdated
|
||
this.exports = new Proxy(this.exports, handler); | ||
// const handler = { |
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 assume this code will be removed before shipping?
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.
yes, cleanup and docs are pending semantic reviews
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.
Sounds good, I'll leave this thread as a reminder.
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.
@jkrems should be good for another review
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
Does this mean that live bindings no longer work? Or is this just an alternate approach with the same runtime semantics but improved performance? |
@ljharb It means live bindings are no longer implicit. If an instrumentation library wants to mutate |
Gotcha, thanks for clarifying. |
Instead of this, or a Proxy, have setters been considered? |
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.
👀
Is there a performance problem in the wild for reference? |
I'd be curious to know what the slowdown is (how dramatic in %) and if it's something we should direct to V8. They've been doing a lot of work on optimizing Proxies. I think being explicit for core is fine. Maybe not so user-friendly but user-land is there in most cases to smooth things over as needed. |
There is multiple evidence that any slowdown in Note that this applies to |
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
Is this design premature optimization then since the nextTick scenario is one of a small group of super hot areas? |
@jdalton my point of view is expressed in #29426 (comment). |
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 notice that syncExports doesn't re-sync the default export of the module.exports
value is overridden somehow. Not sure if this is possible, but it could be worth ensuring this for definite?
Just had a brief chat with @bmeck about this and we're both happy with the state of the PR to merge. Removing the WIP flag. |
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.
tools/doc/README.md should not change. The REPLACEME
example in that doc is correct.
The CI output indicates that the |
b03bad2
to
089de0b
Compare
@Trott we should be ready to land here finally. |
Windows CI failure seems unrelated. |
When you're looking at a node-test-pull-request result, the "Resume Build" option in the left nav will create a new job that retains all the green results and only re-runs the yellow and green results. Useful for this situation! (And not to be confused with "Rebuild" which will re-run everything.) I just used it (and the bot posted the link right above). |
PR-URL: #29737 Reviewed-By: Guy Bedford <guybedford@gmail.com> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Jan Krems <jan.krems@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Minwoo Jung <minwoo@nodesource.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Merging this at the same time as the source maps PR it seems we might have an interaction causing a failure. Looking into a fix PR now, but if I can't get something soon will post a revert. |
So far haven't been able to replicate locally. #29846 is passing against the same master, so it may just be a Travis thing... let's see how the other commits on master go too. |
Here's a CI job I just kicked off against master: https://ci.nodejs.org/job/node-daily-master/1700/ |
@guybedford That CI job is looking very good. I think you're in the clear. |
Yes it seems the Travis build doesnt do well with merges close together,
but all looks good now.
…On Sat, Oct 5, 2019 at 21:41 Rich Trott ***@***.***> wrote:
Here's a CI job I just kicked off against master:
https://ci.nodejs.org/job/node-daily-master/1700/
@guybedford <https://github.com/guybedford> That CI job is looking very
good. I think you're in the clear.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#29737?email_source=notifications&email_token=AAESFSXUDO2RQZKDKPRTSP3QNE65DA5CNFSM4I3I2BZKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEAN7QTI#issuecomment-538703949>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAESFSTLBWGCMYPD7UJNZ3LQNE65DANCNFSM4I3I2BZA>
.
|
PR-URL: #29737 Reviewed-By: Guy Bedford <guybedford@gmail.com> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Jan Krems <jan.krems@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Minwoo Jung <minwoo@nodesource.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesThis removes the proxy from builtin modules used to sync named exports. Instead, a manual call to
require('module').syncESMExports()
will sync all the builtin exports exceptdefault
properties. The semantics need documentation updated, but wanted to open this to make sure the semantics are the expected ones and make sure test changes match expectations.CC: @nodejs/modules