If you build to asm.js instead of wasm, you can use the emdump tool from inside tools/emdump.py to get a full detailed analysis of code sizes. The sizes will naturally not be the same for asm.js and wasm, but proportionally the could be similar, so % sizes could be estimated.
ke 6. helmik. 2019 klo 18.34 Александр Гурьянов ([email protected]) kirjoitti: > > Hi. I think that best way to do it is to use wasm-opt from binaryen > (thanks to Alon, hi told me how to do this): > > bin/wasm-opt --func-metrics test/hello_world.wast > == > global > [funcs] : 1 > func: add > [binary-bytes] : 7 > [total] : 3 > binary : 1 > local.get : 2 > export: add (add) > [removable-bytes-without-it]: 48 > > That prints out per-function metrics, in particular the last part > computes how much the wasm could be optimized down if the function > were not there. So it measures not just the function size but how much > it "holds on to" in the rest of the wasm, that can otherwise be > removed (it measures that by removing it, running the full optimizer, > and seeing how much is left). It's easy to extend it to do other > related things (see src/passes/Metrics.cpp) > == > > So, for example in linux environment you can do something like: > bin/wasm-opt --func-metrics test/hello_world.wast | grep "func: <func-name>" > -A1 > > For better linking, I get this from > https://groups.google.com/forum/#!topic/emscripten-discuss/NCO4LxMbsg0 > > > > > > Ideally, a program that would take the name of a C function as input, and > > output the number of bytes that the specified function contributes to the > > final wasm file, along with the number of bytes that it contributes to the > > final js file. > > > > I rewrote my application to use functions provided in html5.h, instead of > > relying on SDL, and this resulted in significant size savings. So, if I > > could have more insight into the overall weight of specific functions, I > > could probably craft similarly thin alternatives, which could significantly > > improve both download and start-up speeds (especially on mobile devices). > > > > -- > > 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 [email protected]. > > 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 [email protected]. > 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 [email protected]. For more options, visit https://groups.google.com/d/optout.
