The Ruby language is more commonly associated with Web applications than it is with scientific computing. But VirtualModule, now in development, could help change that by making Ruby code run much faster.
"From my quick benchmarking, with VirtualModule, Ruby code runs 10 times to 50 times faster when the number of loops is big," developer Kei Sewada said. The Github repo for VirtualModule says that it can hopefully make Ruby code more than three times faster. VirtualModule is not the first venture for bridging Ruby and scientific computing; Sewada did note SciRuby as another project in this vein.
Provided as a rubygem, open source VirtualModule uses ruby2julia to transpile from Ruby to the Julia dynamic language for scientific computing.The transpiled program uses the msgpack inter-process messaging library to complete each RPC call, Sewada said.
Akin to writing Python code using the Cython static compiler, VirtualModule enables a reduction in execution time in exchange for a limitation in Ruby syntax due to the ruby2julia transpiler. When this restriction is lessened, the project will be promoted to a beta stage.
Julia is supported as the back end of VirtualModule as of the current 0.1.0 release. Other language virtual machine processes, such as JRuby or Rubinius, may be supported in the future. Ruby 2.1 or higher is necessary for running VirtualModule, the Github repo states, and Docker containers can be used with VirtualModule to run the Julia VM.
While focused on simplicity, Ruby has sometimes left something to be desired as far as speed. With VirtualModule, Sewada hopes to ride the momentum of recent projects like the Ruby Deoptimization Engine that aim to improve Ruby's overall performance.