New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
We need a solid wasm code size profiler #20
Comments
The inlined functions feature require some kind of debugging information that does not exist. Source maps don't have that information, however DWARF does (3.3.8.2):
|
There is cargo-bloat which has some initial work on this, but it doesn't support wasm (yet). cc @RazrFalcon . |
AFAIU, we need to parse WASM binaries(?) and it's out of scope for For more advanced features we need a better name mangling in rustc, because the current one does not preserve all the information. See rust-lang/rust#45691 (comment) |
I'm not sure if parity-wasm could do what you need @RazrFalcon but maybe @pepyakin could shed some light on that or if they know of some other crate that might if it exists today. |
Yeah, parity-wasm is capable of parsing WASM binaries. Although it still lacks support of reading name section which might be useful for the usecase. However, there is ongoing PR. |
Btw, @emk already started something called wasm-bloat ! |
@pepyakin This wouldn't allow you to detect inlined functions (that would require source map support, I think), but for function-level stuff, it means that I may continue work on |
Ok, I've got the start of a code profiler that does a lot of what I laid out in the original comment. I've filed lots of issues, too, for folks who want to help build it! Happy to mentor / help anyone get up to speed with it. |
@fitzgen small heads up that svelte is also the name of a JS UI framework: https://github.com/sveltejs/svelte. Name collisions are unavoidable, and it doesn't seem like they're actively exploring wasm right now but I do see the potential for confusing searches in the future. |
Given the advent and integration of Twiggy, I'm gonna close this! |
I hacked up a little script here: https://github.com/fitzgen/source-map-mappings/blob/master/source-map-mappings-wasm-api/who-calls.py
But that was just a hacky thing out of necessity. What I really want is:
Lists for functions, crates, and data segments, sorted by largest size
who-calls.py
script does this, and shows callers as well, displayed as a treeTree map visualizations grouped by function, crate, and data segment
List the path(s) in the call graph from any given private function back to an exported function
who-calls.py
does a very basic version of thiswasm-gc
can't statically prove that the code is deadDominator trees to tell me which function F transitively keeps the most code size from other child functions "rooted" in the call graph, even if F itself has a small code size (and so you might otherwise ignore it). By "rooted" I mean "reachable from exported functions in the call graph", ie won't get removed by
wasm-gc
.I want to know which logical functions got inlined into any given physical function in the wasm
.wasm
file?Similarly, I want to be able to investigate monomorphizations of generic functions
The text was updated successfully, but these errors were encountered: