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

WebAssembly #62

Closed
linclark opened this issue Mar 1, 2018 · 26 comments
Closed

WebAssembly #62

linclark opened this issue Mar 1, 2018 · 26 comments

Comments

@linclark
Copy link

linclark commented Mar 1, 2018

Anyone want to talk about WebAssembly?

By late May, the work to make WebAssembly modules just plain ES modules will be underway, possibly with prototypes in JS engines (including V8).

There has also been some discussion around using WASM for "native" modules, so we could hash out what the requirements are and what would need to be added to the spec. @lukewagner from the WASM WG will likely be able to join for this if we have any questions about what changes to the spec are possible.

@GlenTiki
Copy link

GlenTiki commented Mar 1, 2018

I'd love to if there was interest in the Rust compiling to WASM story. I'm currently prepping a talk about this that might interest people. It's aimed to be introductory to both rust and WASM noobs, like me.

It is however my first tech talk. I'll be giving it at a nodejs meetup the 14th of this month, so I should be able to share the video from it here if people would like to review it, after I've given it once.

Something interesting I've already found:
screen shot 2018-02-27 at 01 27 46

I've based these benchmarks off @fhinkel's awesome post here: https://medium.com/the-node-js-collection/speed-up-your-node-js-app-with-native-addons-5e76a06f4a40

Repo here: https://github.com/thekemkid/wasm-v-js-v-native

@targos
Copy link

targos commented Mar 1, 2018

I'm in! I contribute to several libraries ported from C++ to WebAssembly and it's not always easy to import them and work with the bindings created with emscripten.

@bmeurer
Copy link

bmeurer commented Mar 1, 2018

@thekemkid Note however that in this particular example a lot of the time difference is due benchmark artifacts, not because WASM or C++ would be faster than JavaScript. That is, the JavaScript version is not semantically equivalent to the C++ version. If you change the C++ version to match the JS code, it'll probably be slower than the JS version.

@GlenTiki
Copy link

GlenTiki commented Mar 1, 2018

@bmeurer Could you explain further what you mean by "benchmark artifacts"? My benchmark came with the caveat/gotcha that it is purely a naively implemented rust lib with js-like code that is compiled to wasm to see an immediate perf improvement with a similar module API. I'm sure all three of these in the comparison could be improved greatly with some optimisation! (This is getting off topic, but I'm unsure where to take the conversation, sorry!)

EDIT: just seen your edit! Gotcha

@mhdawson
Copy link
Member

mhdawson commented Mar 1, 2018

I'm interested with respect how WebAssembly might be integrated and positioning versus N-API. It has been discussed in that context a few times.

@bmeurer
Copy link

bmeurer commented Mar 1, 2018

@thekemkid The choice of IEEE754 as the one and only Number type in JavaScript is probably a big factor, whereas C++ gives you int. Not saying that WebAssembly or Rust or C++ cannot be useful, but let's just try to avoid giving the false sense of a performance boost just because you use a different language.

@ashleygwilliams
Copy link

i'll def be in Europe (rustfest paris is may 27-29) around this time and could perhaps swing by to talk about the rust->wasm story and packaging wasm for npm if people are interested

@linclark
Copy link
Author

linclark commented Mar 1, 2018

For this discussion, we may want to scope it to WebAssembly features that Node needs and keep it language independent. I do think it would be worthwhile to have a separate breakout about Rust+WASM, though.

@ashleygwilliams
Copy link

makes sense @linclark, lemme know and i can probably be around. i think there may be a few other convos at the event that i'll need to be in anyways so i might be around regardless.

@ofrobots
Copy link

ofrobots commented Mar 2, 2018

I'm in! I am quite excited about this as this has to

Today native modules are distributed on npm in source code form (C++, Rust etc.) which must be compiled using a compiler toolchain, which must either be present on the end-user/deployment system, or through a build system in a deployment pipeline. Not to mention the expense (install time, cpu resources) to get these modules built. This is specially a concern on PaaS and FaaS services.

Some native module authors try to avoid this end-user complexity by 'shipping' pre-compiled binaries which are typically hosted on a download service somewhere (s3, github, etc.). There are many rough edges with this: need to host multiple binaries for the cross product of {cpu_arch ⨯ OS ⨯ libc ⨯ NODE_MODULE_VERSION}; need to manage and potentially pay for download bandwidth; need to setup complicated build/CI system.

Wasm can be an excellent portable distribution format for Node native modules. We will need some extra features around FFI, host bindings and possibly the execution environment, but it seems worthwhile to explore.

Looking forward to talking about this more at the summit.

/cc @hashseed @flaxgor

@emilbayes
Copy link
Contributor

emilbayes commented May 21, 2018

I'd like to participate as well. I've been using WASM to handwrite a lot of crypto with @mafintosh, and will also be talking about handwriting webassembly at JSConf after the summit. We also maintain sodium-native which is bindings to a cryptographic library written in C, so I have lots of input on what would be required of WASM before it would be able to supplement the prebuilds we currently ship, albeit I am still sceptical of entirely replacing the native bindings. Excited to hear proposals for FFI!

@yoshuawuyts
Copy link
Contributor

Happy to attend! - sat in on some of the Rust allhands WASM sesssions a few weeks ago; would be keen to come hang out again on the Node side too! ✨

@xtuc
Copy link

xtuc commented May 21, 2018

I'm working on the integration in JS bundlers, but haven't planned to come at the summit. Are you interested in having me around @linclark @ashleygwilliams?

@linclark
Copy link
Author

@xtuc Thanks for offering. I don't expect that bundlers will be a big part of this discussion, so feel free to stick with your current plans.

@mcollina
Copy link
Member

@linclark do you also need the talk slot or are you ok with the 1.5h workshop slot?

@linclark
Copy link
Author

@mcollina We can fill the talk slot if needed, but just having the 1.5 hour workshop slot will also be fine.

@NickNaso
Copy link

I will happy to attend and in particular I'm interested with respect how WebAssembly might be integrated and positioning versus N-API.

@bmeurer
Copy link

bmeurer commented May 21, 2018

I'd like to talk a bit about WASM JIT and how we can support/encourage that use case. We have a prototype of such a library in jaro-sevcik/webassembly-jit, that's based on the support functions for the WebAssembly test suite in the V8 repository.

@linclark
Copy link
Author

@mcollina looking at the schedule, I realized there's a big time gap between the talk and the workshop. I'm thinking it probably makes the most sense for us to just kick off the workshop with the talk, which means we won't need the talk slot. Does that work for you all?

@mcollina
Copy link
Member

@linclark it works, but I think we can swap Modules with WebAssembly. Would that work for you?

@linclark
Copy link
Author

@mcollina Ah, that's a good idea. That would be perfect, thanks!

@MylesBorins
Copy link
Contributor

Oh hey... come join us for the discussion on zoom

https://zoom.us/j/301437498

@Trott
Copy link
Contributor

Trott commented May 31, 2018

Closing issues for sessions that happened. Re-open if that's the wrong thing to do.

@Trott Trott closed this as completed May 31, 2018
@benjamingr
Copy link

Did anyone take notes?

@emilbayes
Copy link
Contributor

@yoshuawuyts has extensive notes

@yoshuawuyts
Copy link
Contributor

Notes: https://github.com/yoshuawuyts/knowledge/blob/master/computers/2018-05-31-wasm-notes.md

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests