9. https://webassembly.org/
• Announced in 17 June 2015
• Supported by major Browsers
• Developed by WebAssembly Working
Group (W3C)
• Draft specific published 15 Feb 2018
17. Usage Scenarios in Web
• Write faster versión of the specific application
• Using existing C libraries in browser
• Reuse algorithm from service side
• Distribute whole application as wasm
18.
19. Video editor: https://d2jta7o2zej4pf.cloudfront.net/
Game (Unity): http://webassembly.org/demo/Tanks/
Garden (Unreal Engine): https://s3.amazonaws.com/mozilla-
games/ZenGarden/EpicZenGarden.html
WebSight: https://websightjs.com
AutoCAD: https://web.autocad.com
Samples
23. Before anything…
• Razor MVC
• Razor Pages
• Similar to ASP.NET
ViewComponents.
• Is more an MVVM framework
• Enables two-way data binding
• Useful for SPA apps.
24. Running .NET in the browser
“The first step to building a .NET-based SPA framework is to have a way of
running .NET code inside web browsers. We can at last do this based on open
standards, supporting any web browser (without any plugins), thanks to
WebAssembly.”
28. So, Wich one is better?
AOT
Production
Environments
Interpreter
Development
Time
Currently: Interpreter, is on (enabled) by default and AOT mode is not ready to be tried yet
https://elguerre.com/2018/04/11/javascript-ha-muerto-net-web-assembly-con-blazor/
Gracias a @alSkachkov
https://octoverse.github.com/
Since 1995 there are severals alternatives to get a better performance…
https://webassembly.org/docs/faq/
https://webassembly.org/
Works for:
Firefox
Chorme
Safari
Edge
Opera (Just in a Desktop. At 2018/06/26).
No Works for:
IE
Brower Compatibility: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly
https://webassembly.org/docs/faq/
To enable WebAssembly to be read and edited by humans, there is a textual representation of the wasm binary format:
https://developer.mozilla.org/en-US/docs/WebAssembly/Understanding_the_text_format
It’s a compact bytecode format optimised for minimum download sizes and maximum execution speed. Despite what a lot of developers first assume, it does not introduce new security concerns, because it isn’t regular assembly code (e.g., x86/x64 or similar) - that can only do what JavaScript can do. it’s a new bytecode format
http://www.mono-project.com/news/2018/01/16/mono-static-webassembly-compilation/
MVC:
Razor Pages: It’s similar to ASP.NET ViewComponents. Is more an MVVM framework. It enables two-way data binding. Useful for SPA apps.
http://blog.stevensanderson.com/2018/02/06/blazor-intro/
Interpreter:
The Mono runtime itself is compiled to WebAssembly, but your .NET assembly files are not. The browser can then load and execute the Mono runtime, which in turn can load and execute standard .NET assemblies (regular .NET .dll files) built by the normal .NET compilation toolchain.
This is similar to how, for the desktop CLR, the core internals of the CLR are distributed precompiled to native code, which then loads and executes .NET assembly files. One key difference is that the desktop CLR uses just-in-time (JIT) compilation extensively to make execution faster, whereas Mono on WebAssembly is closer to a pure interpretation model.
Ahead-of-time (AOT) compiled mode
In AOT mode, your application’s .NET assemblies are transformed to pure WebAssembly binaries at build time. At runtime, there’s no interpretation: your code just executes directly as regular WebAssembly code. It’s still necessary to load part of the Mono runtime (e.g., parts for low-level .NET services like garbage collection), but not all of it (e.g., parts for parsing .NET assemblies).
This is similar to how the ngen tool has historically allowed AOT compilation of .NET binaries to native machine code, or more recently, CoreRT provides a complete native AOT .NET runtime.
Interpreter: Faster
AOT: Smaller and compression-friendly compared with AOT-compiled assemblies
Backlog
A component model for building composable UI
Routing
Layouts
Forms and validation
Dependency injection
JavaScript interop
Live reloading in the browser during development
Server-side rendering
Full .NET debugging both in browsers and in the IDE
Rich IntelliSense and tooling
Ability to run on older (non-WebAssembly) browsers via asm.js
Publishing and app size trimming
Practically any portable C or C++ codebase can be compiled into JavaScript using Emscripten !!!
List of portable language: https://github.com/kripken/emscripten/wiki/Porting-Examples-and-Demos
http://kripken.github.io/emscripten-site/
https://github.com/WebAssembly/design/issues/1087