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 to 50 times faster when the number of loops is big," developer Kei Sewada said. The GitHub repo for VirtualModule says it can hopefully make Ruby code more than three times faster. VirtualModule is not the first venture for bridging Ruby and scientific computing; Sewada noted 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 interprocess 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 VM 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 at times lagged in 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.
This story, "Ruby picks up pace for scientific computing" was originally published by InfoWorld.