
3/4/2015
What this post added
This post announces the open-sourcing of go-lua, an implementation of the Lua programming language in Go. It details the motivation for building go-lua, which was to provide a scripting engine for Shopify's load generation tool, allowing for dynamic flow definition. The post outlines the technical decision to implement Lua in Go rather than using C bindings, highlighting benefits like garbage collector integration and reduced context creation overhead. It describes the implementation process, involving manual porting of the Lua 5.2 compiler and VM from C to Go. Key challenges discussed include performance optimizations for the interpreter's inner loop, specifically addressing Go's switch statement behavior and function call inlining, leading to the exploration of function table dispatch. The post also presents benchmark results comparing go-lua to C Lua and gopher-lua, and lists current limitations such as the absence of coroutines and weak references.