The .asm.js file is not needed when building wasm, and it should not be getting emitted (see https://github.com/kripken/emscripten/pull/4807). Also, --separate-asm should never be passed when targeting wasm (see https://github.com/kripken/emscripten/issues/4909). Feel free to delete .asm.js file when doing a wasm only build, if it for some reason is haunting around.
2017-09-05 18:52 GMT+03:00 Jonathan Marston <marstonstu...@gmail.com>: > Note, compiling on a Mac using the versions provided through homebrew, which > are currently > > emscripten 1.37.18 > > binaryen 37 > > > On Tuesday, September 5, 2017 at 11:50:36 AM UTC-4, Jonathan Marston wrote: >> >> I have an emscripten project where I compile FFMPEG to run inside a worker >> thread for encoding microphone PCM samples. I compile two separate versions >> with BINARYEN=1 and 0 to create separate outputs for asm.js and WebAssembly. >> I do my own browser support tests to decide which one to use. Here is the >> snippet from my Makefile that uses the two separate build flags. >> >> =========== >> >> CFLAGS = -v -O3 \ >> -I./dist/include \ >> -s OUTLINING_LIMIT=10000 \ >> -s TOTAL_MEMORY=16777216 \ >> -s NO_EXIT_RUNTIME=1 \ >> -s EXPORTED_FUNCTIONS="['_main', '_init' . . . . . . ]" \ >> --pre-js pre.js \ >> --post-js post.js >> >> ifeq ($(FORMAT), wasm) >> FORMATFLAGS = -s BINARYEN=1 -s BINARYEN_TRAP_MODE="'clamp'" >> else >> FORMATFLAGS = -s BINARYEN=0 --memory-init-file 1 >> endif >> >> program: prepare >> $(CC) $(CFLAGS) $(FORMATFLAGS) $(SOURCES) -o $(TARGET) $(LDFLAGS) >> $(LDLIBS) >> >> ========= >> >> invoked separately >> >> emmake make FORMAT=wasm >> emmake make FORMAT=asmjs >> >> ========== >> >> The asmjs build produces two files. (I'm not using the --separate-asm >> optimization because that doesn't work when loading in a web worker.) >> >> pcm-encoder-asmjs.js 1.0MB >> pcm-encoder-asmjs.mem 202KB >> >> The WebAssembly build produces three files >> >> pcm-encoder-wasm.js 167KB >> pcm-encoder-asmjs.wasm 693KB >> pcm-encoder-wasm.asm.js 1.9MB >> >> Is this separate asm.js file necessary? Why is it so large compared to the >> asmjs build? Is there any way to optimize the WebAssembly build using >> current stable emscripten compiler so I don't need the file or can shrink it >> down? >> >> The details were not clear to me after reading the documentation here, >> https://github.com/kripken/emscripten/wiki/WebAssembly >> >> "WebAssembly code is prepared somewhat differently than asm.js. asm.js can >> be bundled inside the main JS file, while as mentioned earlier WebAssembly >> is a binary file on the side, so you will have more than one file to >> distribute." >> >> I understand that the pcm-encoder-wasm.js file is necessary for properly >> loading the wasm file, but it's not clear to me what purpose the separate >> asm.js file serves or if it can be optimized. >> >> Is this just a temporary artifact while we are using the asm2wasm until >> the new LLVM backend is being developed? >> >> Any tips on optimizing the build output are greatly appreciated >> >> Jon Marston > > -- > You received this message because you are subscribed to the Google Groups > "emscripten-discuss" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to emscripten-discuss+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "emscripten-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-discuss+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.