Improve VM performance by reducing instruction size
Closed this issue · 3 comments
Per this reddit thread that discussed various different methodologies of significantly speeding up SuperFetch's virtual machine - reducing the instruction size by encoding offset flags as part of the instructions opcode seemed to be the most feasible and performant because it reduces the overall size of the instruction by 3 bytes(assuming there aren't more than 256 opcode types - I'll explain that later) herby reducing cache misses, and it'll reduce the processing time per instruction by bypassing the need for runtime computation of registers and their offsets.
A potential issue would be that there may be more than 256 (the max amount of enum types that can still fit in a byte), opcode types, there may be certain performance issues. However, instructions sizes will still have been signifgantly decreased and runtime offsetting bypassed.
Added the branch fast-vm, this will be where updates to the vm take place.
There are 54 compiler opcodes and 294 machine opcode types (compiler opcodes but with offset flags included). There should not be a major impact to performance.
Completed