Skip to content
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

Research Discussion: "Smash-ons" vs add-ons to simplify access to native libraries #9494

Closed
ghost opened this issue Nov 6, 2016 · 2 comments
Labels
feature request Issues that request new features to be added to Node.js.

Comments

@ghost
Copy link

ghost commented Nov 6, 2016

Add-ons are a cool way to let node .js code access native code, be-it OS api's or other native libraries. However, deploying add-ons means that either A) the target machine must have a minimal build tool chain (which may not always be the case on a production server), or that B) the add-on must be prebuilt for all possible platforms and then downloaded (yuck). And building add-ons means being adept in C/C++ and quite familiar with V8's api's and internals.

I know other VM's offer marshalling services, like .NET's P/Invoke, that lets the VM get access to native stuff without first requiring some code getting compiled to native form.

It seems to me most add-ons today are just mostly marshallers. Now I'm sure a full-on native marshaller built as an add-on can provide the best marshalling performance, but I know from my own experience in other runtime worlds there's a bunch of use cases, like just wanting to a call a couple OS methods, that could be handled just fine, performance wise, with a built-in marshalling service.

I also know that in some cases some types are expensive to marshall, and if it's a 'chatty' api, using a built-in marshalling service wouldn't be ideal, performance wise, but would still be adequate and a reasonable trade off to the aforementioned constraints of building native add-ons.

Has anyone thought of or looked at the possibility of including a marshalling service directly in node? Besides me?

I've named a node module that calls into a native marshaller a "smash-on" because it's funny sounding, but also kinda hints at, that while easier to make, might be a tiny bit less performant in some cases.

I have ideas on how to add a marshalling service to node, and would enjoy doing so I think. Just trying to collect the thoughts and opinions of others in the know.

@mscdex
Copy link
Contributor

mscdex commented Nov 6, 2016

There is already an ffi module and previous discussion on including it in core, but the discussion died out a long time ago.

@mscdex mscdex added the feature request Issues that request new features to be added to Node.js. label Nov 6, 2016
@ghost
Copy link
Author

ghost commented Nov 6, 2016

@mscdex Thanks. Closing this issue.

@ghost ghost closed this as completed Nov 6, 2016
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Issues that request new features to be added to Node.js.
Projects
None yet
Development

No branches or pull requests

1 participant