Thinkofdeath•

So i've seen a few rust-asm.js demos and almost of them have "almost asm"; (Line 5342) instead of "use asm"; which means (I believe) none of the optimisations for asm.js are actually being used. Is rust somehow tripping up emscripten causing it to fallback to that or something?

7
pyfischOP•

I haven’t changed the file, probably it is true that rust trips up Emscripten.

3
CryZe92•

You don't need to specify which functions to export in the latest nightlies anymore btw. But yeah, I'm very curious why there's still almost asm. We disabled vectorization which causes almost asm, so I'm not entirely sure what else would cause it.

3
pyfischOP•

A asm.js file build today is "use asm". Looks like the bug was fixed.

1
usinglinux•

that would make a nice comparison case for asm.js vs wasm too; i'd love to see this compiled to the latter.

5
pyfischOP•

I wrote this demo a few weeks ago and said back then, I will try WASM again when the MVP is finished but now Firefox ships WASM but still I can't get it working. I first updated compiler and emscripten then I did not load the wasm module correctly. (You need to load it with JS fetch or XmlHttpRequest yourself because Emscripten is does not load it itself for some reason in the browser.) Then the version of the module was mismatched. The produced .wasm file was version 0xd but the version identifier was reset to 0x1 for the MVP. I even tried to change the version in a hex editor but this just surfaced another parse error later in the file (in both Firefox and Chrome).

So unless someone else gets this to work I will wait some weeks before trying again.

2
piaoger•

it works fine though output js is a little bit large , about 1mb.

2
pyfischOP•

The output is a few weeks old. Rust or Emscripten have seen some improvements in file size. Now the output is 476_912 Bytes so less than a half mb. wasm is even smaller (168_146 bytes) but needs some boilerplate emscripten (220_123 bytes) which consumes the saved space again. (I don't even know what the emscripten code does, except it does not work for me). In theory the WASM file should be called only with a few lines of JS.

2