In Focus

Ruby 2.6.0 Brings A New JIT Compiler

Ruby 2.6.0 has been released with a new JIT compiler and the RubyVM::AbstractSyntaxTree module.

Ruby v2.6.0, the latest version of Ruby, has been released recently. The team has announced that this version incorporates a new JIT compiler and the RubyVM::AbstractSyntaxTree module along with a number of new features and performance improvements.
Ruby 2.6.0 Released 
New JIT compiler
Ruby 2.6.0 comes with an early implementation of a Just-In-Time (JIT) compiler. According to the company, traditional JIT compilers operate in-process while Ruby’s JIT compiler gives out a C code to the disk and generates a common C compiler to create the native code.
To enable the JIT compiler, you are required to specify –jit either on the command line or in the $RUBYOPT environment variable. Using –jit-verbose=1 will cause the JIT compiler to provide additional information. This compiler will work only when Ruby is built by GCC, Clang, or Microsoft Visual C++ and the same platform needs to be available at runtime.
On Optcarrot (a CPU intensive benchmark) Ruby 2.6 has shown, the company claims, 1.7x faster performance compared to Ruby 2.5. The JIT compiler, however, is still experimental and workloads like Rails might not benefit from it for now.
RubyVM::AbstractSyntaxTree module
The new version also brings the RubyVM::AbstractSyntaxTree module that has a parse method which parses a given string as Ruby code and returns the Abstract Syntax Tree (AST) nodes in the code. The file is opened and parsed by the parse_file method as Ruby code and returns AST nodes.
A new class, RubyVM::AbstractSyntaxTree::Node, is also introduced in Ruby 2.6.0. as an experimental feature. Developers can get the source location and children nodes from the node objects.
To learn more about other new features and improvements in detail, you can visit the official announcement.