I think after WebAssembly comes, we could do more dynamic things with better 
performance. And it's also cross-platform. So with the two advantages (both of 
them just like Weex does), there must be some points that WebAssembly will 
create values in our field.

And I think the "JS service" way with v8 in Android is much safer try than 
other ways.

Thanks.

Jinjiang

On Mar 09, 2017, at 06:22 PM, Bono Lv (Ali ZiKuan) <[email protected]> 
wrote:

Hi Hanks
WebAssembly seems to promising.  It will bring real performance boosting to 
Weex.
After reading some document about this technical, I found one of WeBAssembly design goals 
is the key to possibly integrating,"Non-Web Embeddings"[1].And there is an 
experimental repo[2] about the goal. 

[1]:https://github.com/WebAssembly/design/blob/master/NonWeb.md 
[2]:https://github.com/jfbastien/musl

Best Regards!
-----------------
Bono Lv
------------------------------------------------------------------From:Feng Adam 
<[email protected]>Send Time:2017年3月9日(星期四) 16:06To:dev 
<[email protected]>Subject:Re: What about the WebAssembly
WebAssembly has a lot of benefits:

   - not parsing Javascript any more as it is already an intermediate
   representation
   - taking less time to download as it is more compact than Javascript
   - garbage collection is not required any more

It will be a game changer for the web and Weex.

But I think it is not ready ,   for it is only supported on the latest
version of Chrome/Safari/Firefox, and it is experimental yet.

We will keep our eyes on it.

2017-03-09 14:54 GMT+08:00 Hanks Zhang <[email protected]>:

 WebAssembly is a new portable, size- and load-time-efficient binary format
 suitable for compilation to the web. [1] It's a new technology tendency and
 reached consensus by Chrome, Edge, Firefox, and WebKit. [2] It will affect
 the developer's choice between web and native (or Weex). However, it will
 not change the structure of the native developments, and can be complement
 with Weex.

 I have studied this technology for some time now. Here is my views on how
 to use the WebAssembly in Weex:

 1. Add a js service to load WebAssembly module.

   loadWebAssembly('path/to/lib.wasm').then(instance => {
       // ...
   })

 2. Offer a native module to compile wasm binary files.

   const wasm = weex.requireModule('wasm')
   wasm.load('path/to/lib.wasm', instance => {
       // ...
   })

 3. Support to use <script type="module"> directly in ".we" and ".vue"
 syntax.

   <script type="module" src="path/to/lib.wasm"></script>


 For the first proposal, we can use js service to create a global methods
 "loadWebAssembly", which can load and compile the wasm binary file into
 WebAssembly module. Acrooding to the official defined JS API [3], the
 "loadWebAssembly" should also return a Promise.

 I have already implement it on my personal repo [4]. But I still have some
 concerns:

   * I use the "stream" module to fetch wasm files, but the data in the
 response must be "text" or "json", can't be binary. I have to convert the
 "text" to ArrayBuffer manully. It's inefficient, and it should be done in
 the native.
   * It's hard to achieve the cache.


 For the second and third proposal, it's much efficient than the first and
 much harder to achieve.

 It's a little radical. Feel free to discuss the proposals, I will explain
 the details.

 -------

 [1] http://webassembly.org/
 [2]
 https://lists.w3.org/Archives/Public/public-webassembly/2017Feb/0002.html
 [3] http://webassembly.org/docs/js/
 [4] https://github.com/Hanks10100/weex/tree/wasm/html5/services/wasm

 -------

 Hanks

Reply via email to