-
Notifications
You must be signed in to change notification settings - Fork 0
WebAssembly
Kota edited this page Sep 25, 2018
·
2 revisions
- A code (binary code format, .wasm extension) that can be run in modern web browsers and provides new features and major gains in performance
- .wat format, human readable format of .wasm
- Started in 2015. Standardized by W3C group
- Web assembly gets executed by the javascript runtime (vm) on the browser
- JS should be understood by runtime whereas wasm is written in runtime understandable format, so faster
- Web assembly can also run on other places than in web browser
-
Run code at near-native speed. 6-20 times faster than JavaScript (scenario based)
- byte code (lower level language) so smaller in size
- Other languages can be compiled to WebAssembly. Like C++, C#, Razor, Java etc..
- Natively supported by all major browsers (doesn't require plugins)
- Secure: Runs in the java-script sandbox
- JavaScript code can run WebAssembly modules
- Since it is browser based, it works on all devices desktop, mobile, tablet, virtual device etc..
- Javascript has lot of benefits and are faster enough for normal operations.
- Javascript is Human readable
- Not supported by IE
- Video / Audio editing
- Video / Audio streaming
- Gaming
- Video / Audio Calling
- Virtual / Augmented reality
- AI on client. Ex: Image recognition
- Compile C# to dll -> the dll runs on the mono runtime (Mono.wasm), which is converted into webassembly and runs on webassembly runtime => Microsoft Blazor Toolchain
- Create ASP.NET Core web Application -> Blazor template -> OK
- Javascript loads the wasm file and runs it. Also, wasm can call Javascript code
Resources:
- https://webassembly.org/ - Official WebAssembly website
- https://developer.mozilla.org/docs/WebAssembly - Developer documentation
- http://www.wasmrocks.com - Tutorials and articles
Downloads:
- https://marketplace.visualstudio.com/items?itemName=aspnet.blazor - Blazor for Visual Studio
Tool:
- https://github.com/aspnet/Blazor - Run C# in the browser
- https://webassembly.studio/ - Online WebAssembly development environment
- https://mbebenita.github.io/WasmExplorer - online C/C++ to wasm convertor
Demo: