Reduce optimize overhead
Currently the call to optimize
can take a non-negligable amount of time for complex trees. There are a few reasons for this:
- There is no notion that optimization has already been done (memoization might help)
- Each optimize call returns an entirely new object
- The optimize calls were built in an ad-hoc way as needed.
The optimize machinery would benefit from added memoization or perhaps a redesign to use existing AST trasnformer techniques. I'm not exactly sure where to start with this, but users of this project should be aware that this is an issue and any help with mitigating it would be greatly appreciated.