3 ms·
There was a nice post here recently about speeding up interpreters via closure-based interpreter: https://news.ycombinator.com/item?id=43595283 https://news.yc
by stevekemp 1y ago
There was a nice post here recently about speeding up interpreters via closure-based interpreter:
https://news.ycombinator.com/item?id=43595283 https://news.ycombinator.com/item?id=43595283
I hacked up a toy brainfuck interpreter using that technique and it was pretty fast. Not sure I'd get the chance to use it elsewhere, but experimenting with it was useful regardless:
https://github.com/skx/closure-based-brainfuck-vm https://github.com/skx/closure-based-brainfuck-vm
- codr7 1y agoI am very curious about the difference between an array of closures and an array of alternating function pointers and data. The latter doesn't come very naturally in most languages, you need something very C like for it to make sense. But my gut feeling says static functions and having access to the data right there in the same array might play better with cache.