News for hackers. Stuff that matters.
Re:Faster interpreters in Go: Catching up with C++ by stevekemp on Sunday April 06, 2025 @02:39PM (#43603803)
I put together this example after reading the article:

https://github.com/skx/simple-vm

Simpler than the full gomacro codebase, but perhaps helpful.

Re:Faster interpreters in Go: Catching up with C++ by cosmos0072 on Sunday April 06, 2025 @03:03PM (#43604018)
For optimal speed, you should move as much code as possible outside the closures.

In particular, you should do the `switch op` at https://github.com/skx/simple-vm/blob/b3917aef0bd6c4178eed0c... outside the closure, and create a different, specialised closure for each case. Otherwise the "fast interpreter" may be almost as slow as a vanilla AST walker.

Re:Faster interpreters in Go: Catching up with C++ by stevekemp on Sunday April 06, 2025 @11:24PM (#43607319)
That's fair, thanks for taking the time to look and giving the feedback.