binaryen
binaryen copied to clipboard
Add a HeapSnapshotAnalysis pass
Chrome and Edge DevTools can capture heap snapshots, which are JSON representations of the entire object graph at a moment in time. Add a pass that can parse such a snapshot and report statistics about how much of the heap is occupied by Wasm objects and what the top types are by cumulative heap size and allocation count.
I'll add a test for this before we land it. I'm also open to suggestions of interesting analyses to run. I don't have a heap snapshot of a module with a name section, but eventually I would like to support printing details of the type definitions when I can match up names in the snapshot to names in the module.