Questions tagged [webassembly]

WebAssembly (abbreviated Wasm) is a new portable, size- and load-time-efficient format suitable for compilation to the web.

WebAssembly

WebAssembly (abbreviated Wasm) is a binary instruction format for a stack-based virtual machine. Wasm is designed as a portable compilation target for programming languages, enabling deployment on the web for client and server applications.

Efficient and fast

The Wasm stack machine is designed to be encoded in a size- and load-time-efficient binary format. WebAssembly aims to execute at native speed by taking advantage of common hardware capabilities available on a wide range of platforms.

Safe

WebAssembly describes a memory-safe, sandboxed execution environment that may even be implemented inside existing JavaScript virtual machines. When embedded in the web, WebAssembly will enforce the same-origin and permissions security policies of the browser.

Open and debuggable

WebAssembly is designed to be pretty-printed in a textual format for debugging, testing, experimenting, optimizing, learning, teaching, and writing programs by hand. The textual format will be used when viewing the source of wasm modules on the web.

Part of the open web platform

WebAssembly is designed to maintain the versionless, feature-tested, and backwards-compatible nature of the web. WebAssembly modules will be able to call into and out of the JavaScript context and access browser functionality through the same Web APIs accessible from JavaScript. WebAssembly also supports non-web embeddings.

Resources

2772 questions
34
votes
5 answers

Compile Swift to WebAssembly

The LLVM infrastructure now supports compiling from LLVM IR to WebAssembly (at least experimentally). Swift uses the LLVM compiler infrastructure and can easily be compiled to LLVM IR. So I thought it would be straightforward to compile some Swift…
Rob Mecham
  • 593
  • 7
  • 9
31
votes
4 answers

C# WASM without Blazor

I want to be able to call C# code from JavaScript. The mono project used to have a WASM SDK that you could download from their old Jenkins server, but that is no longer public. Existing docs tend to point toward those builds. The Azure Devops builds…
eltiare
  • 1,817
  • 1
  • 20
  • 28
30
votes
3 answers

Why is webAssembly function almost 300 time slower than same JS function

Find length of line 300* slower First of I have read the answer to Why is my WebAssembly function slower than the JavaScript equivalent? But it has shed little light on the problem, and I have invested a lot of time that may well be that yellow…
Blindman67
  • 51,134
  • 11
  • 73
  • 136
30
votes
2 answers

Can I read files from the disk by using Webassembly?

I followed the Webassembly getting started tutorial http://webassembly.org/getting-started/developers-guide/ It worked fine and displayed the "Hello, world!" message in the browser. Then I tried a small C++ code, that opens a text file and does the…
Thiago Silvino
  • 411
  • 1
  • 4
  • 5
30
votes
5 answers

Can I somehow build webassembly code *without* the emscripten "glue"?

Can I somehow create a wasm file, that will work on its own as described in MDN here (by instatiating the objects and calling functions on them)? All the guides I can find (such as this one on MDN) recommend using emscripten; that will, however,…
Karel Bílek
  • 36,467
  • 31
  • 94
  • 149
29
votes
4 answers

How to return a string (or similar) from Rust in WebAssembly?

I created a small Wasm file from this Rust code: #[no_mangle] pub fn hello() -> &'static str { "hello from rust" } It builds and the hello function can be called from JS: