A peek into the WebAssembly Browser Preview

Windows

Windows
Following the
Please, Log in or Register to view URLs content!
Please, Log in or Register to view URLs content!
, we have been working with other browser vendors including
Please, Log in or Register to view URLs content!
,
Please, Log in or Register to view URLs content!
,
Please, Log in or Register to view URLs content!
, along with the rest of the
Please, Log in or Register to view URLs content!
, to
Please, Log in or Register to view URLs content!
with
Please, Log in or Register to view URLs content!
. WebAssembly is a new, portable, size- and load-time-efficient binary compiler target, which promises near-native performance on the web.

As the community group comes close to consensus over the final design of the
Please, Log in or Register to view URLs content!
(minimum viable product) release, we are pleased to share that the WebAssembly standard is in
Please, Log in or Register to view URLs content!
and invite the community to
Please, Log in or Register to view URLs content!
on the WebAssembly
Please, Log in or Register to view URLs content!
. We’re continuing to make progress towards a public preview implementation in Microsoft Edge, and today we’re excited to demonstrate WebAssembly in our internal builds.

The Browser Preview


The WebAssembly browser preview is effectively a release candidate for MVP, and includes the latest:

  • Please, Log in or Register to view URLs content!
    , generalized from previous AST formats to a more efficient
    Please, Log in or Register to view URLs content!
    format; a more compact binary format generally means better loading time.
  • Equivalent human-readable
    Please, Log in or Register to view URLs content!
    for the purpose of reading, debugging, and occasionally handwriting WebAssembly.
  • Built-in
    Please, Log in or Register to view URLs content!
    to integrate WebAssembly modules to the web platform.
  • Up-to-date tools to produce WebAssembly modules, such as the
    Please, Log in or Register to view URLs content!
    Please, Log in or Register to view URLs content!
    toolchain to convert C++ source to asm.js to WebAssembly, and
    Please, Log in or Register to view URLs content!
    to convert between text and binary format.

To give you a taste of what WebAssembly looks like now, here is an example C++ recursive factorial function with its corresponding WebAssembly:

C++ factorial​
WebAssembly factorial function body
binary | text
int factorial(int n)
{
if (n == 0)
return 1;
else
return n * fac(n-1);
} 20 00 | get_local 0
42 00 | i64.const 0
51 | i64.eq
04 7e | if i64
42 01 | i64.const 1
05 | else
20 00 | get_local 0
20 00 | get_local 0
42 01 | i64.const 1
7d | i64.sub
10 00 | call 0
7e | i64.mul
0b | end

The WebAssembly factorial function is extracted from the WebAssembly
Please, Log in or Register to view URLs content!
.​

We are eager to
Please, Log in or Register to view URLs content!
from the community on WebAssembly. App authors should still expect changes and recompilation of apps for the MVP release, but any feedback from
Please, Log in or Register to view URLs content!
during the preview will help us make a better standard.

Implementation Progress in Microsoft Edge


We’ve been hard at work developing support for WebAssembly in Microsoft Edge at the open-source
Please, Log in or Register to view URLs content!
. Microsoft Edge and ChakraCore are
Please, Log in or Register to view URLs content!
to shipping the browser preview, which we expect to come when the full JavaScript APIs are implemented.

To demo the current capability of ChakraCore, we are also excited to showcase the
Please, Log in or Register to view URLs content!
demo (with an updated WebAssembly binary) running in an internal build of Microsoft Edge. The demo loads faster than earlier versions compiled to asm.js or older WebAssembly formats, due to a more compact binary and ChakraCore’s new ability to defer parsing WebAssembly functions.


Over the next couple of months, our team will be focused on bringing the browser preview to Microsoft Edge. We look forward to continuing to contribute to the
Please, Log in or Register to view URLs content!
with the other browser vendors and the community, and would love to hear your thoughts about WebAssembly via
Please, Log in or Register to view URLs content!
and
Please, Log in or Register to view URLs content!
, or on the
Please, Log in or Register to view URLs content!
repo.

Please, Log in or Register to view URLs content!
, Program Manager, Chakra

Please, Log in or Register to view URLs content!
 

Users who are viewing this thread

Top