3,056 questions
37
votes
3
answers
25k
views
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 ...
0
votes
2
answers
480
views
Running Python on Server and sending results to Client and vice versa [closed]
So basically, what I want to do is have a user input some data in an HTML form or something (on client end). Have that data be carried over to a server, where the data is put through some python code ...
4
votes
1
answer
4k
views
WebAssembly: TypeError: WebAssembly Instantiation: Imports argument must be present
I'm trying to get up to speed with WebAssembly, relying mostly on WebAssembly developer's guide and a recent JSConf talk. I can compile a token hello world program, and I can view the generated HTML ...
8
votes
1
answer
2k
views
Webassembly trig functions possible?
Does webassembly have support for trig functions? I mean like built in support because it seems we have to import those from javascript. It would be great if we had things like:
f32.sin
f32.cos
If it ...
1
vote
1
answer
777
views
Webassembly meaning of the 0x40 byte?
The specification says that 0x40 is:
a pseudo type for representing an empty block_type
Now im not entirely sure what they mean by that. Even if my block is not empty the compiler would give me 0x40 ...
0
votes
1
answer
379
views
WebAssembly: (f32.const nan:0x200000) means 0x7fa00000 or 0x7fe00000
In C, strtof("nan(0x200000)", nullptr) represented as 0x7fe00000. But in WebAssembly spec interpreter tests:
(assert_return (invoke "f32.reinterpret_i32" (i32.const 0x7fa00000)) (f32.const nan:...
39
votes
3
answers
25k
views
How can I check if a browser supports WebAssembly?
With support for WebAssembly coming into all new major browsers, how can I check whether the current browser which is visiting my website supports it?
4
votes
1
answer
2k
views
How to resolve function pointers in Rust & WebAssembly
I want to provide a WebAssembly module with an external JavaScript function that accepts a Rust function pointer.
Once this JS module is initialized, it will call the run() function from the .wasm ...
15
votes
2
answers
4k
views
How do I keep internal state in a WebAssembly module written in Rust?
I want to do computations on a large set of data each frame of my web app. Only a subset of this will be used by JavaScript, so instead of sending the entire set of data back and forth between ...
30
votes
4
answers
15k
views
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:
<!DOCTYPE ...
2
votes
1
answer
1k
views
How to control or read max wasm table size?
I'm trying to build a common js environment for arbitrary wasm executable modules (for now, presumed generated from emscripten). One of my problems that the wasm output wants a table imported that has ...
3
votes
1
answer
3k
views
How can I create and reference a table in WebAssembly?
Can someone please share the syntax to create a table statically having certain elements and reference it? I could not find any web assembly code doing so.
Also some details like can I have multiple ...
4
votes
1
answer
872
views
removing "-s ONLY_MY_CODE=1" compilation argument causes WebAssembly program to break
I have a small WebAssembly program that works correctly when compiled via the following bash script:
source_list="../../src/cpp/main/main.cc"
emcc -std=c++11 $source_list -o out/index.html -O1 -s ...
3
votes
1
answer
745
views
Functions available to WebAssembly [closed]
Does anyone know of a list of functions which are available to call from WebAssembly when running in a modern web browser?
Or perhaps the answer is that there are no such functions except the ones ...
18
votes
1
answer
10k
views
How to use WebAssembly (wasm) code in a Web Worker?
Currently, a Web Worker is instantiated thus:
let worker = new Worker('worker.js');
The browser then fetches worker.js and it can start responding to messages.
I'd like to implement my worker's ...
4
votes
1
answer
1k
views
Accessing UInt8ClampedArray in Rust web assembly
I would like to pass an array containing imageData from a Canvas to a Rust function to do some calculation with it. I have set the return type to null the get one way data passing to work:
JS
wasm....
2
votes
1
answer
1k
views
How can I find out the address of a WebAssembly buffer and return it to Javascript?
I'm trying to obtain the memory address of a WebAssembly buffer and return it to Javascript, so that I can instaniate its memory as a Javascript ArrayBuffer and directly write in an array in the ...
6
votes
1
answer
9k
views
How to pass a string to C code compiled with emscripten for WebAssembly
I've been looking a the WebAssembly website and tutorials and I feel a bit lost.
I have the following C code :
void EMSCRIPTEN_KEEPALIVE hello(char * value){
printf("%s\n", value);
}
I ...
15
votes
1
answer
2k
views
Passing a JavaScript array of strings to a C function with Emscripten
I'm new to WebAssembly and Emscripten and am trying to pass an array of strings in JavaScript to a C function for further processing with Module.cwrap(...). Ideally I'd also like to return an array of ...
0
votes
1
answer
1k
views
Did webassembly support openmp?
As title , anyone know webassembly support openmp or not?
If support, how to use it?
Thanks.
7
votes
1
answer
2k
views
How do I generate a minimal wasm file with Rust?
I can generate a fairly minimal (203 bytes) wasm file from the following C code by running emcc -O3 -s WASM=1 -s SIDE_MODULE=1 -o sum.wasm sum.c.
#include <emscripten/emscripten.h>
int ...
2
votes
1
answer
989
views
How can I link multiple webassembly modules? I am using reference interpreter to compile S-exp to wasm?
Importer module:
(module
(type $GG (func (param i32) (result i32)))
(import "low" "load" (func $load (param i32) (result i32)))
(table (import "low" "table") 2 anyfunc)
(...
0
votes
2
answers
3k
views
MediaSteam interaction with WebAssembly
Is there a known way to get a video stream from the browser back into WebAssembly? I know that you can do frame capture using HTML canvas, but I am unaware of how to get the entirety of the stream (...
14
votes
2
answers
4k
views
"Assertion failed: you need to wait for the runtime to be ready" Error when calling a C function in JavaScript
I am trying out a simple example to call a C function compiled to .wasm with JavaScript.
This is the counter.c file:
#include <emscripten.h>
int counter = 100;
EMSCRIPTEN_KEEPALIVE
int ...
1
vote
1
answer
117
views
Compilation to the web
What format does WebAssembly compile code to?
From official site:
WebAssembly or wasm is a new portable, size- and load-time-efficient format
suitable for compilation to the web.