4 ms·
Caveat: I've barely used Go personally. Just speculating on what GP specifically meant, but Go lacks the ability to pack structs, and probably lacks the equiva
by spijdar 5y ago
Caveat: I've barely used Go personally.
Just speculating on what GP specifically meant, but Go lacks the ability to pack structs, and probably lacks the equivalent of tricks like computed gotos [0] to increase bytecode interpreter speeds. In general, Go seems to (intentionally) lack a lot of low-level control of code generation, preferring a "there's one way to do things, and it either works, or it's a bug we'll fix" approach.
Which is probably for the best in "most" software, but interpreters typically use weird hacks to squeeze more performance out of the rock. Wren is a good example [1] of some of these optimizations, and has splendid comments/documentation.
[0] https://eli.thegreenplace.net/2012/07/12/computed-goto-for-efficient-dispatch-tables https://eli.thegreenplace.net/2012/07/12/computed-goto-for-e...
[1] https://github.com/wren-lang/wren/blob/main/src/vm/wren_vm.c https://github.com/wren-lang/wren/blob/main/src/vm/wren_vm.c