Kagami / vmsg

:musical_note: Library for creating voice messages
https://kagami.github.io/vmsg/
Creative Commons Zero v1.0 Universal
348 stars 58 forks source link

Emscripten comparison #4

Closed kripken closed 6 years ago

kripken commented 6 years ago

If I understand correctly you replace the emscripten JS and runtime with custom code? I'm curious if you have a comparison on the overhead that saves (especially in -O3 or -Os so that metadce is run).

And is it mainly in JS (in which case, comparing with --closure 1 is most interesting) or wasm?

(I ask because maybe this can point us to things we should improve in emscripten.)

Kagami commented 6 years ago

Yes, it's only related to JavaScript wrapper code (Module handling, fetching binary and other stuff) produced by Emscripten. With --closure 1 it weights about 10kb minified (not gzipped), while in my particular case I can load and use module with a bit more than 40 lines:

https://github.com/Kagami/vmsg/blob/efcbb9ffdd718fe0aebd13b19d0018b71027bfcc/vmsg.js#L15-L55

kripken commented 6 years ago

I see, thanks!

Makes sense. I was worried we had overhead in the wasm code, good to know it's just in JS, where it's a known issue.

Eventually I hope emscripten can emit something like those 40 lines, by making a lot of the current functionality optional and modular.