WebAssembly

Using Any Executable Program in the Browser, e.g. Game Emulators

The Snex9x emulator code used for our On-Chain Super Nintendo Emulator is ported to WebAssembly byte code so that it can work in the browser. Meaning the original C++ source code is compiled into a WebAssembly binary which allows browsers to run the code with near native-like performance as well as access APIs via JavaScript to handle communication between the user and the application.

WebAssembly (often abbreviated as Wasm) is an open standard that defines a binary-code format and a corresponding textual assembly language for executable programs. It's a portable compilation target for programming languages, enabling deployment on the web for client and server applications. Here are some key aspects of WebAssembly:

  1. Language Agnostic: While JavaScript is the primary language of the web, WebAssembly allows developers to write code in multiple languages such as C, C++, Rust, and more. This code is then compiled into bytecode which can be executed in the browser.

  2. Speed: WebAssembly is designed to be faster to parse than JavaScript and faster to execute, which can be crucial for performance-critical applications like games, music streaming, video editing, and more.

  3. Security: WebAssembly runs in a sandboxed execution environment, just like JavaScript, making it secure for use in web browsers.

  4. Portability: The WebAssembly code is designed to be portable and efficient for various platforms, including mobile and IoT devices.

  5. Efficiency and Size: WebAssembly aims to be both fast to execute and compact to transmit over the Internet, which is beneficial for users with slower internet connections.

  6. Integration with the Web Platform: WebAssembly is designed to interoperate seamlessly with JavaScript and the wider web platform, allowing for the use of Web APIs and other JavaScript functionality.

WebAssembly is gaining popularity for applications that require high performance and low latency, such as video games, music streaming, video editing, and CAD applications. It allows developers to take advantage of the speed and power of low-level languages while still running in a web browser.

Last updated