WebAssembly/design

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

WebAssembly/design

Owen Densmore
Administrator
As was announced yesterday, WebAssembly language (replacing asm.js) is seriously real.  Here's a FAQ
​    ​
https://github.com/WebAssembly/design/blob/master/FAQ.md#faq

​There is still hope for JS itself, however.  JS can import wasm:

Is WebAssembly only for C/C++ programmers?

As explained in the high-level goals, to achieve a Minimum Viable Product, the initial focus is on C/C++. However, byintegrating with JS at the ES6 Module interface, web developers don't need to write C++ to take advantage of libraries that others have written; reusing a modular C++ library can be as simple as using a module from JS.

Beyond the MVP, another high-level goal is to improve support for languages other than C/C++. This includes allowing WebAssembly code to allocate and access garbage-collected (JS, DOM, Web API) objects. Even before GC support is added to WebAssembly, it is possible to compile a language's VM to WebAssembly (assuming it's written in portable C/C++) and this has already been demonstrated (123). However, "compile the VM" strategies increase the size of distributed code, lose browser devtools integration, can have cross-language cycle-collection problems and miss optimizations that require integration with the browser.

​My guess is that Java or GWT (Google Web Toolkit) will eventually be able compile to wasm​. So you're right again, Frank!


   -- Owen

============================================================
FRIAM Applied Complexity Group listserv
Meets Fridays 9a-11:30 at cafe at St. John's College
to unsubscribe http://redfish.com/mailman/listinfo/friam_redfish.com
Reply | Threaded
Open this post in threaded view
|

Re: WebAssembly/design

Russell Standish-2
What's the idea - to embed C++ objects into the JS VM?

On Thu, Jun 18, 2015 at 11:05:49AM -0600, Owen Densmore wrote:

> As was announced yesterday, WebAssembly language (replacing asm.js) is
> seriously real.  Here's a FAQ
> ​    ​
> https://github.com/WebAssembly/design/blob/master/FAQ.md#faq
>
> ​And Brendan Eich:
>     https://brendaneich.com/2015/06/from-asm-js-to-webassembly/​
>
> ​There is still hope for JS itself, however.  JS can import wasm:
>
> Is WebAssembly only for C/C++ programmers?
>
> As explained in the high-level goals
> <https://github.com/WebAssembly/design/blob/master/HighLevelGoals.md>, to
> achieve a Minimum Viable Product, the initial focus is on C/C++
> <https://github.com/WebAssembly/design/blob/master/CAndC++.md>.
> However, byintegrating
> with JS at the ES6 Module interface
> <https://github.com/WebAssembly/design/blob/master/MVP.md#modules>, web
> developers don't need to write C++ to take advantage of libraries that
> others have written; reusing a modular C++ library can be as simple as using
> a module from JS <http://jsmodules.io/>.
>
> Beyond the MVP, another high-level goal
> <https://github.com/WebAssembly/design/blob/master/HighLevelGoals.md> is to
> improve support for languages other than C/C++. This includes allowing
> WebAssembly code to allocate and access garbage-collected (JS, DOM, Web
> API) objects
> <https://github.com/WebAssembly/design/blob/master/FutureFeatures.md#gcdom-integration>.
> Even before GC support is added to WebAssembly, it is possible to compile a
> language's VM to WebAssembly (assuming it's written in portable C/C++) and
> this has already been demonstrated (1 <http://ruby.dj/>, 2
> <https://kripken.github.io/lua.vm.js/lua.vm.js.html>, 3
> <https://syntensity.blogspot.com/2010/12/python-demo.html>). However,
> "compile the VM" strategies increase the size of distributed code, lose
> browser devtools integration, can have cross-language cycle-collection
> problems and miss optimizations that require integration with the browser.
>
> ​My guess is that Java or GWT (Google Web Toolkit) will eventually be able
> compile to wasm​. So you're right again, Frank!
>
>
>    -- Owen

> ============================================================
> FRIAM Applied Complexity Group listserv
> Meets Fridays 9a-11:30 at cafe at St. John's College
> to unsubscribe http://redfish.com/mailman/listinfo/friam_redfish.com


--

----------------------------------------------------------------------------
Prof Russell Standish                  Phone 0425 253119 (mobile)
Principal, High Performance Coders
Visiting Professor of Mathematics      [hidden email]
University of New South Wales          http://www.hpcoders.com.au
----------------------------------------------------------------------------

============================================================
FRIAM Applied Complexity Group listserv
Meets Fridays 9a-11:30 at cafe at St. John's College
to unsubscribe http://redfish.com/mailman/listinfo/friam_redfish.com
Reply | Threaded
Open this post in threaded view
|

Re: WebAssembly/design

Marcus G. Daniels
It's like a .so file for a web browser, except that instead of being natively compiled, it is portable and gives native-like performance.  It's like NaCL (Google Chrome), but cross browser.    It's not a plug-in model where extensions need to be prepared ahead of time as pre-built extensions (one for Mac, one for Windows, etc).  

________________________________________
From: Friam <[hidden email]> on behalf of Russell Standish <[hidden email]>
Sent: Thursday, June 18, 2015 4:05 PM
To: Complexity Coffee Group
Subject: Re: [FRIAM] WebAssembly/design

What's the idea - to embed C++ objects into the JS VM?

On Thu, Jun 18, 2015 at 11:05:49AM -0600, Owen Densmore wrote:

> As was announced yesterday, WebAssembly language (replacing asm.js) is
> seriously real.  Here's a FAQ
> ​    ​
> https://github.com/WebAssembly/design/blob/master/FAQ.md#faq
>
> ​And Brendan Eich:
>     https://brendaneich.com/2015/06/from-asm-js-to-webassembly/​
>
> ​There is still hope for JS itself, however.  JS can import wasm:
>
> Is WebAssembly only for C/C++ programmers?
>
> As explained in the high-level goals
> <https://github.com/WebAssembly/design/blob/master/HighLevelGoals.md>, to
> achieve a Minimum Viable Product, the initial focus is on C/C++
> <https://github.com/WebAssembly/design/blob/master/CAndC++.md>.
> However, byintegrating
> with JS at the ES6 Module interface
> <https://github.com/WebAssembly/design/blob/master/MVP.md#modules>, web
> developers don't need to write C++ to take advantage of libraries that
> others have written; reusing a modular C++ library can be as simple as using
> a module from JS <http://jsmodules.io/>.
>
> Beyond the MVP, another high-level goal
> <https://github.com/WebAssembly/design/blob/master/HighLevelGoals.md> is to
> improve support for languages other than C/C++. This includes allowing
> WebAssembly code to allocate and access garbage-collected (JS, DOM, Web
> API) objects
> <https://github.com/WebAssembly/design/blob/master/FutureFeatures.md#gcdom-integration>.
> Even before GC support is added to WebAssembly, it is possible to compile a
> language's VM to WebAssembly (assuming it's written in portable C/C++) and
> this has already been demonstrated (1 <http://ruby.dj/>, 2
> <https://kripken.github.io/lua.vm.js/lua.vm.js.html>, 3
> <https://syntensity.blogspot.com/2010/12/python-demo.html>). However,
> "compile the VM" strategies increase the size of distributed code, lose
> browser devtools integration, can have cross-language cycle-collection
> problems and miss optimizations that require integration with the browser.
>
> ​My guess is that Java or GWT (Google Web Toolkit) will eventually be able
> compile to wasm​. So you're right again, Frank!
>
>
>    -- Owen

> ============================================================
> FRIAM Applied Complexity Group listserv
> Meets Fridays 9a-11:30 at cafe at St. John's College
> to unsubscribe http://redfish.com/mailman/listinfo/friam_redfish.com


--

----------------------------------------------------------------------------
Prof Russell Standish                  Phone 0425 253119 (mobile)
Principal, High Performance Coders
Visiting Professor of Mathematics      [hidden email]
University of New South Wales          http://www.hpcoders.com.au
----------------------------------------------------------------------------

============================================================
FRIAM Applied Complexity Group listserv
Meets Fridays 9a-11:30 at cafe at St. John's College
to unsubscribe http://redfish.com/mailman/listinfo/friam_redfish.com
============================================================
FRIAM Applied Complexity Group listserv
Meets Fridays 9a-11:30 at cafe at St. John's College
to unsubscribe http://redfish.com/mailman/listinfo/friam_redfish.com
Reply | Threaded
Open this post in threaded view
|

Re: WebAssembly/design

Roger Critchlow-2
In reply to this post by Russell Standish-2
I think that was already accomplished by asm.js, given the right C/C++ you could compile to asm.js and run at fastest javascript speeds.

This substitutes a binary format, probably a variant of the LLVM bitcode mentioned elsewhere, which will be code-generated into asm.js by a javascript polyfill for engines that don't support native code generation, but native code generation it will be for those on the bleeding edge.  So the idea is to make it work everywhere from the very start.

The advantage being that the binary encoded WebAssembly code is more compact and even with the polyflll to asm.js it's faster than just downloading the asm.js itself.  And the native code generation should also be blisteringly fast, I've never really seen a slow assembler, so the native code generated version is also ready to run sooner than the javascript or the asm.js version of the code, not to mention running faster.  So it should also work better everywhere from the very start, and work even better where browsers support it.

As Marcus says, like Google's NaCl, except it's PNaCl (Portable Native Cliient) that downloads bitcode for native code generation on the client.

-- rec --


On Thu, Jun 18, 2015 at 4:05 PM, Russell Standish <[hidden email]> wrote:
What's the idea - to embed C++ objects into the JS VM?

On Thu, Jun 18, 2015 at 11:05:49AM -0600, Owen Densmore wrote:
> As was announced yesterday, WebAssembly language (replacing asm.js) is
> seriously real.  Here's a FAQ
> ​    ​
> https://github.com/WebAssembly/design/blob/master/FAQ.md#faq
>
> ​And Brendan Eich:
>     https://brendaneich.com/2015/06/from-asm-js-to-webassembly/
>
> ​There is still hope for JS itself, however.  JS can import wasm:
>
> Is WebAssembly only for C/C++ programmers?
>
> As explained in the high-level goals
> <https://github.com/WebAssembly/design/blob/master/HighLevelGoals.md>, to
> achieve a Minimum Viable Product, the initial focus is on C/C++
> <https://github.com/WebAssembly/design/blob/master/CAndC++.md>.
> However, byintegrating
> with JS at the ES6 Module interface
> <https://github.com/WebAssembly/design/blob/master/MVP.md#modules>, web
> developers don't need to write C++ to take advantage of libraries that
> others have written; reusing a modular C++ library can be as simple as using
> a module from JS <http://jsmodules.io/>.
>
> Beyond the MVP, another high-level goal
> <https://github.com/WebAssembly/design/blob/master/HighLevelGoals.md> is to
> improve support for languages other than C/C++. This includes allowing
> WebAssembly code to allocate and access garbage-collected (JS, DOM, Web
> API) objects
> <https://github.com/WebAssembly/design/blob/master/FutureFeatures.md#gcdom-integration>.
> Even before GC support is added to WebAssembly, it is possible to compile a
> language's VM to WebAssembly (assuming it's written in portable C/C++) and
> this has already been demonstrated (1 <http://ruby.dj/>, 2
> <https://kripken.github.io/lua.vm.js/lua.vm.js.html>, 3
> <https://syntensity.blogspot.com/2010/12/python-demo.html>). However,
> "compile the VM" strategies increase the size of distributed code, lose
> browser devtools integration, can have cross-language cycle-collection
> problems and miss optimizations that require integration with the browser.
>
> ​My guess is that Java or GWT (Google Web Toolkit) will eventually be able
> compile to wasm​. So you're right again, Frank!
>
>
>    -- Owen

> ============================================================
> FRIAM Applied Complexity Group listserv
> Meets Fridays 9a-11:30 at cafe at St. John's College
> to unsubscribe http://redfish.com/mailman/listinfo/friam_redfish.com


--

----------------------------------------------------------------------------
Prof Russell Standish                  Phone 0425 253119 (mobile)
Principal, High Performance Coders
Visiting Professor of Mathematics      [hidden email]
University of New South Wales          http://www.hpcoders.com.au
----------------------------------------------------------------------------

============================================================
FRIAM Applied Complexity Group listserv
Meets Fridays 9a-11:30 at cafe at St. John's College
to unsubscribe http://redfish.com/mailman/listinfo/friam_redfish.com


============================================================
FRIAM Applied Complexity Group listserv
Meets Fridays 9a-11:30 at cafe at St. John's College
to unsubscribe http://redfish.com/mailman/listinfo/friam_redfish.com