Awesome, thanks! вт, 5 февр. 2019 г. в 05:27, Alon Zakai <[email protected]>: > > I think binaryen could be a good basis for part of that. For example, it > currently can run stuff like 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) > > On the other hand, if you want a code explorer type thing on wasm text, then > wabt is the right tool since it has full support for parsing and emitting the > wasm text format (binaryen can parse and emit just a subset of the wasm text > format, the s-expression part). > > Overall, binaryen focuses on the wasm binary format and optimizing and > analyzing it, while wabt focuses on reading and writing of the full wasm > standard, both binary and text. > > On Mon, Feb 4, 2019 at 9:31 AM Александр Гурьянов <[email protected]> wrote: >> >> Hi guys! I want to write some tool to analyze wasm files. My first >> target is to create tool like bloaty to analyze size of contribution >> of each function in resulting size. But bloatly is universal tool, I >> want to concentrate on wasm format and maybe create something like >> "code explorer" tool (like go-to symbol, jump to declaration etc.). >> Anyway I need to parse wasm in some way. >> >> From Binaryen page: >> ``` >> Binaryen also provides a set of toolchain utilities that can >> >> Parse and emit WebAssembly. In particular this lets you load >> WebAssembly, optimize it using Binaryen, and re-emit it, thus >> implementing a wasm-to-wasm optimizer in a single command. >> ``` >> >> So maybe is good way to start. I can write fake optimization pass, >> that just counting sizes. Is it possible? I didn't find any example >> how to do wasm-2-wasm, or how to get AST from wasm source. >> >> Anyway, for "code explorer" part, I need parse wasm as AST or similar >> structure, is Binaryen good for this? >> >> I also found this projects: >> https://github.com/WebAssembly/wabt >> https://github.com/xtuc/webassemblyjs >> >> All of them looks solid, but I don't understand pros+cons >> >> Thanks! >> >> -- >> 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.
