-
Notifications
You must be signed in to change notification settings - Fork 30.9k
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
module: expose Module._runInThisContext
#6288
Conversation
`Module._runInThisContext` can be overridden to store/load cached compilation artifacts when embedding node.js .
hmmm... not sure about this one. What are the ramifications of exposing this? |
Actually none. It is already possible to override this through overriding The rationale behind this patch is that I have recently tried to add V8 code cache to electron and it turned out that it is notoriously hard to do it in a clean way without copy-pasting code from the core. |
@indutny Can you elaborate on the use-case for exposing the code cache to a node embedder? What would electron do with the cached artifacts? |
@ofrobots what's the point of introducing them in V8 in a first place? :) To speed up the compilation and to reduce the startup time? |
I guess what I'd prefer to see on this is a proper public API as opposed to
|
@jasnell maybe... but we don't even have a documentation for |
Or... Perhaps only expose this if the
|
@jasnell I'd rather not choose the second option. The embedder's code should work on regular node as much as possible. This is useful for testing, and code sharing as well. |
-1 from me, feels too much like a hack. |
I feel like this should be properly discussed first and that the API should look very different. |
7da4fd4
to
c7066fb
Compare
Bump |
@nodejs/ctc ... please weigh in on this. |
-0, every Are you imagining embedders would replace this with their own wrapper to intercept for the purpose of capturing or inserting the cached version? That use is kind of like I'd even be happier with adding interceptor callbacks to the |
-1. If we want to support this, it should be a public documented api, and it most likely shouldn't be prefixed with a If we don't want to support that — what's the reason for exporting it in the current state? To achieve something that is not supported by the API, embedders could just add their patches on top and support those themselves. |
even exporting it in its current state (without |
CTC moved this discussion back here - we'd like to find a more elegant way of exposing this API |
c133999
to
83c7a88
Compare
@nodejs/ctc ... looks like the was never any follow up on this. Recommend closing if we're not going to pursue it. |
Feel free to reopen this PR if you get back to working on it. |
Checklist
Affected core subsystem(s)
module
Description of change
Module._runInThisContext
can be overridden to store/load cachedcompilation artifacts when embedding node.js .
cc @nodejs/collaborators @zcbenz