Ruby 2.6 Adds JIT
Written by Kay Ewbank   
Monday, 11 June 2018

There's a new preview of Ruby that is the first in the Ruby 2.6.0 series. The developers say the preview has been released earlier than usual because it includes an important new feature, JIT.

Ruby is a very popular programming language partially due to the the fact that it is fun to use, and useful because of its mix of different programming styles - functional, dynamic and object-oriented.

rubylogo2a

The JIT is the major improvement to the new version. The Just-In-Time compiler will make programs execute faster, and is interesting because the developers say that it works differently from JIT compilers in other languages. Ruby’s JIT compiler prints C code to a disk and spawns a common C compiler process to generate native code. The preview release has been made so that users of Ruby can check if it works for their particular platform and will also discover any security risks before the 2.6 release. The JIT compiler is currently only supported when Ruby is built by gcc or clang and the compiler is available on runtime.

The developers say that this version of the JIT is an early one and very few optimizations are implemented, so it's not ready for benchmarking final performance, especially for larger programs like Rails applications. Future versions will include method inlining, which is expected to increase Ruby’s performance in order of magnitude.

Away from the JIT compiler, the preview includes a new module, RubyVM::AST. This module has a parse method that parses a given ruby code that's a string, and returns a set of AST (Abstract Syntax Tree) nodes. The module also has a parse_file method that parses a given Ruby code file and returns AST nodes.

Other new features include the addition of an endless range that you can use without specifying how large the range is; and an Add Binding#source_location method that returns the source location in the form of a two element array containing the file and line.

rubylogo2a

More Information

Ruby Official Site

Related Articles

Ruby 2.5 Adds Support For Branch Coverage

Commercial Ruby Distro Enters Beta

Ruby On Rails Reaches 5.0

Ruby 2.3 Released

ActiveState Extends to Ruby, Node.js, Go and Lua

To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on Twitter, Facebook or Linkedin.

 

Banner


Rust And C++ Should Be Friends?
20/11/2024

The Rust Foundation has just released a statement on Rust and C++ interoperability and Google is ponying up $1 to see that it gets done.



Prompt Engineering Techniques To Make You An Expert
18/11/2024

Introducing a GitHub repository full of hot tips and instructions on how to build the perfect prompt presented in a collection of Jupiter Notebooks.


More News

 

espbook

 

Comments




or email your comment to: comments@i-programmer.info