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

You can use emscripten to generate fairly minimal code output. Consider the following trivial file adder.c: int adder (int a, int b) { return a + b; } Compile it like this (requires a fairly recent emscripten): emcc -O2 -s WASM=1 -s SIDE_MODULE=1 -o adder.wasm To see what it generated, disassemble it to wast textual … Read more

C# WASM without Blazor

Yes it’s absolutely possible. Blazor does not have a monopoly on C#/WASM and it’s far from clear that it’s going to wind up being the best long term option (and a lot of evidence it’s not). I recommend starting with the Uno WASM Bootstrap. https://github.com/unoplatform/Uno.Wasm.Bootstrap 2022-06-30 Edit – More evidence Blazor is not the only … Read more

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

Andreas describes a number of good reasons why the JavaScript implementation was initially observed to be x300 faster. However, there are a number of other issues with your code. This is a classic ‘micro benchmark’, i.e. the code that you are testing is so small, that the other overheads within your test loop are a … Read more

TypeError: Failed to execute ‘compile’ on ‘WebAssembly’: Incorrect response MIME type. Expected ‘application/wasm’

One possible workaround is to use instantiate() instead of instantiateStreaming(), since the former doesn’t care about MIME types (while the latter does). To use instantiate(): async function fetchAndInstantiate() { const response = await fetch(“http://localhost:3000/simple.wasm”); const buffer = await response.arrayBuffer(); const obj = await WebAssembly.instantiate(buffer); console.log(obj.instance.exports.add(1, 2)); // “3” }

Compile Swift to WebAssembly

1) To the best of my knowledge as of early Nov, 2017 you are correct: there is no commonly available way to compile Swift to WebAssembly. Maybe some enterprising hacker somewhere has made it happen but if so she hasn’t shared her code with us yet. 2) In order to enable Wasm support you will … Read more

tech