Yes, browsers can understand the binary and since it’s bytecode, written with a statically typed language like Rust or C/C++, it can give you better performance.
I am no expert in Web-Assembly / WAMS, I am also learning, so in this article, I will be sharing a simple example which will help you understand the working of Web-Assembly and get started with it.
Let’s get started:
1. Generate the Bytecode or Binary Code:
To generate the WASM bytecode, I am using the following tool: https://wasdk.github.io/WasmFiddle/ which builds .wasm modules for you from a C-Program.
I am using the following simple c-program for calculating the factorial of a number.
Simply paste your C language code in the top-left section, click on
build, which will compile and build the WASM file or return an error if code has any syntax errors.
After building just click on the WASM Download icon to download the WASM file (bytecode / binary code) to be used in the Application.
Most modern web-browsers execute web-assembly out of the box.
Thank you for reading.