walt
walt copied to clipboard
Optimizer
Goal
Create an optimizing pass.
Overview
Go nuts? There is zero static optimization currently, everything written is emitted.
Dead code elimination sounds great. AssemblyScript does it, which is dope.
Acceptance Criteria
- [ ] It works
- [ ] It's tested
- [ ] It's opt-in and configurable
If the goal is to reduce the size of the final binary I guess you could just replace the func with an empty one (with no code).
Otherwise you'll need to shift every index because the func is not in the module instance anymore.
I don't know which AST format you're using exactly, but I think it's worth looking at some transformations we do in @babel/minify https://github.com/babel/minify/tree/master/packages.