4 ms·
> ideas on how to improve its performance further without making a mess are most welcome. One approach would be designing the input language for performance. I
by gergo_barany 6y ago
> ideas on how to improve its performance further without making a mess are most welcome.
One approach would be designing the input language for performance. In particular, having statically typed operations. A specialized iadd instruction for values that you are sure you want to treat as integers would save you a lot of indirecting through function pointers. A disadvantage of static typing is that you need to implement type checks if you want to guarantee well typedness.
Another (orthogonal) approach would be to consider a JIT backend. Not one you write yourself, that could definitely be considered "making a mess". But in the past I've had success using LibJIT (https://www.gnu.org/software/libjit/ https://www.gnu.org/software/libjit/) for speeding up a stack interpreter. In that case, it was a subset of Python bytecode (see https://github.com/gergo-/pylibjit https://github.com/gergo-/pylibjit, the code has very probably bitrotted).