News for hackers. Stuff that matters.
Re:Show HN: Life – A secure, blazing-fast, cross-platform We... by skybrian on Thursday August 02, 2018 @12:36PM (#17672861)
At first glance, this looks like an ordinary interpreter loop [1] using a large switch statement. I didn't think this was all that fast in Go, compared to C. And yet the JIT version isn't hugely faster and can be slower. Are there performance tricks I'm missing?

[1] https://github.com/perlin-network/life/blob/master/exec/vm.g...

Re:Show HN: Life – A secure, blazing-fast, cross-platform We... by iainmerrick on Thursday August 02, 2018 @04:45PM (#17675311)
Do you mean the JIT engine in this same codebase?

It looks like it generates C code and compiles it on the fly. The generated code seems to do manual stack operations, rather than assigning values to variables, and it’s compiled with -O1 so it won’t be heavily optimized. It will be a bit faster than the interpreter because it avoids the opcode dispatch overhead, but if I understand the code right it’s not surprising that it isn’t a ton faster.