Lightstorm: A Minimalistic Ruby Compiler Boosts Performance with MLIR

2024-12-31

The DragonRuby team developed Lightstorm, a minimalistic Ruby compiler aimed at improving the performance of their cross-platform game engine. Leveraging MLIR, Lightstorm translates mruby VM bytecode into C code, optimizing performance by eliminating load/store and branch operations within the VM's interpreter loop. Benchmark results show performance improvements ranging from 1% to 1200%, with an average reduction of roughly 30% in execution time and cycles. While currently supporting a subset of Ruby, the project validates the feasibility of pre-compiling Ruby code for performance gains. Future plans include replacing critical C components of the engine with compiled Ruby code.

Development Ruby compiler