GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||
GeezerVison is showing github.com — src,doc: Experimental support for SEA by mhdawson · Pull Request #42334 · nodejs/node Conversation
Member
Signed-off-by: Michael Dawson [email protected]
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Collaborator
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
Member
Author
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
mhdawson
commented
Uh oh!
There was an error while loading. Please reload this page.
styfle
reviewed
Uh oh!
There was an error while loading. Please reload this page.
styfle
reviewed
Uh oh!
There was an error while loading. Please reload this page.
styfle
reviewed
Uh oh!
There was an error while loading. Please reload this page.
mcollina
approved these changes
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. lgtm
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
mscdex
reviewed
Uh oh!
There was an error while loading. Please reload this page.
mscdex
reviewed
Uh oh!
There was an error while loading. Please reload this page.
mscdex
reviewed
Uh oh!
There was an error while loading. Please reload this page.
mscdex
reviewed
Uh oh!
There was an error while loading. Please reload this page.
mscdex
reviewed
Uh oh!
There was an error while loading. Please reload this page.
mscdex
reviewed
Uh oh!
There was an error while loading. Please reload this page.
mscdex
reviewed
Uh oh!
There was an error while loading. Please reload this page.
mscdex
reviewed
Uh oh!
There was an error while loading. Please reload this page.
mscdex
reviewed
Uh oh!
There was an error while loading. Please reload this page.
mscdex
reviewed
Uh oh!
There was an error while loading. Please reload this page.
mscdex
reviewed
Uh oh!
There was an error while loading. Please reload this page.
mscdex
reviewed
Uh oh!
There was an error while loading. Please reload this page.
mscdex
reviewed
Uh oh!
There was an error while loading. Please reload this page.
mscdex
reviewed
Uh oh!
There was an error while loading. Please reload this page.
mscdex
reviewed
Uh oh!
There was an error while loading. Please reload this page.
mscdex
reviewed
Uh oh!
There was an error while loading. Please reload this page.
mscdex
reviewed
Uh oh!
There was an error while loading. Please reload this page.
mscdex
reviewed
Uh oh!
There was an error while loading. Please reload this page.
mscdex
reviewed
Uh oh!
There was an error while loading. Please reload this page. Signed-off-by: Michael Dawson <[email protected]> Signed-off-by: Michael Dawson <[email protected]> Signed-off-by: Michael Dawson <[email protected]>
|
There was an error while loading. Please reload this page.
|
Pushed some additional commits to
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Btw, I have a working implementation of SEA in my branch that uses postject main...RaisinTen:node:sea. It also implements the VFS (asar in this case)! The major problem I can think of is that the bootstrap script assumes that I'm using asar as the vfs, so we should probably find a way to allow users to configure it - perhaps by exposing an interface that folks can implement to hook in their custom vfs implementations? Or maybe some other approach that I couldn't think of? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
I tried to expose the embedded data as a buffer on |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Or simply treat VFS as out-of-scope and let the packager utility / embedded script do it. Implementing VFS inside Node.js does not help on its own, since a packager utility is still necessary after all. It is complicated to override Node.js APIs. Plus, there are many edge cases to handle and changes could easily become semver-major. It would significantly increase the maintenance burden for Node.js without tangible benefits (unless something like "node compile" is implemented along with it). |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
I am a bit concerned about the case that the payload could be huge. It is not efficient to prematurely store the payload in memory. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
I had wondered about your comment about 4096 being big enough. In the case of using an additional segment it will already be in memory so perhaps less of a concern. Was the offset you were exposing an offset into the file instead of memory? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
I believe we should keep it as out-of-scope at least to start. Having the SEA support be minimal I think is best and we can then possibly adjust that based on feedback later on. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
But wouldn't that promote monkey-patching in Node.js? I'm not sure if that's necessarily a good thing that we want to promote.
I totally agree with your points but if we support SEA in node, it would mean that we should at least support a way to implement a VFS, even if we don't provide a complete VFS implementation out of the box. The reason is that SEA won't be usable if node can't make sense of the data that was embedded in it. I can think of 2 solutions here:
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
The current approach allocates a I wonder if there's a way to prevent this extra allocation. 🤔 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@RaisinTen If you look at what is in this PR, if isntead of providing the address we provided a buffer created on the native side by passing in the pointer to the binary data it would avoid the copy in a similar manner to now it avoids copying any of the parameters/scripts passed. ie when its in a segement it just uses the memory already loaded when the binary was run. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@RaisinTen in particular if you look at the Node-api code here: napi_status NAPI_CDECL napi_create_external_buffer(napi_env env, API docs That should be creating a buffer without allocating/copying. It does still mean that if the addition is large it will be loaded into memory. Having the binary data come from a read to the exe on disk might still have an advantage if that is done as needed as opposed to pre-loaded. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
This may be being discussed as part of the loaders effort. -> #41076 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Refs: https://github.com/nodejs/node/issues/43432 Refs: #42334 Refs: https://github.com/nodejs/node/blob/main/doc/contributing/technical-priorities.md#single-executable-applications Signed-off-by: Michael Dawson <[email protected]> PR-URL: #43611 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Darshan Sen <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
|
thanks @mhdawson, removed the extra allocation here by passing a no-op FreeCallback :) Local<Value> buffer =
Buffer::New(
isolate,
const_cast<char*>(single_executable_application_code),
single_executable_application_size,
[](char* data, void* hint) {},
nullptr)
.ToLocalChecked(); |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@RaisinTen it would be good to work towards a PR that we might land. Any chance you could PR changes you think are needed to this PR? I think at very least your changes to provide access to a buffer instead of the address would make sense. It would also be a good way to discuss any others and start heading towards 1 shared patch versus us each working on possibly different ones. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I would be happy to send a PR for this but last week I had arranged a meeting between the Postject team and @jesec where we found out that there are some areas that need some more research, like these ones: VFS:
Postject:
... etc. I believe, having a team in node where we can discuss everything about SEA would be the right thing to do here. I've DM'ed you to learn about the process for creating a team and I'll follow that. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Refs: https://github.com/nodejs/node/issues/43432 Refs: #42334 Refs: https://github.com/nodejs/node/blob/main/doc/contributing/technical-priorities.md#single-executable-applications Signed-off-by: Michael Dawson <[email protected]> PR-URL: #43611 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Darshan Sen <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
Refs: https://github.com/nodejs/node/issues/43432 Refs: nodejs/node#42334 Refs: https://github.com/nodejs/node/blob/main/doc/contributing/technical-priorities.md#single-executable-applications Signed-off-by: Michael Dawson <[email protected]> PR-URL: nodejs/node#43611 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Darshan Sen <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Closing in favor of #45038 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.