neo-one
neo-one copied to clipboard
Optimize the compiler
Description
Our compiler emits too much bytecode. Optimize it.
See #2095 for potentially helpful info
Note from call with DiCarlo on 07/28/20: optimizing the compiler does NOT necessarily mean using the existing (or new) VM instructions to perform the same logic with less instructions. It means taking the outputted bytecode and then optimizing that into better bytecode. For example, analyzing the bytecode and finding two identical chunks of bytecode, which can then just be pointed to whenever it needs to be called. High level TypeScript code to low-level bytecode is not the place to focus on. The place to focus is "standard" bytecode to bytecode optimizations.
More ideas from me while working on Neo3 compiler upgrade:
- Keep track of scope with other stack? Like the try stack?
- Stack abstraction in an array of stack items?
- Only initialize a certain number of static slots as opposed to all the slots?
- Optimize jumps better by using short jumps/calls instead of always using JMP_L
https://www.lihaoyi.com/post/HowanOptimizingCompilerWorks.html