←back to thread

445 points r4um | 1 comments | | HN request time: 0.298s | source
Show context
stevekemp ◴[] No.43985565[source]
There was a nice post here recently about speeding up interpreters via closure-based interpreter:

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

replies(1): >>43987190 #
1. codr7 ◴[] No.43987190[source]
I 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.