Ruby 2.6 Adds JIT Compiler
Written by Kay Ewbank   
Friday, 28 December 2018

Ruby 2.6 has been released with an experimental JIT compiler, and an abstract syntax tree module.

Ruby has gained popularity because in addition to being fun to use, it is 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, and though still at the experimental stage, will improve the performance of code, particularly for workloads that make heavy use of the CPU. The developers say their benchmarks have shown improvements of 1.7 times faster than Ruby 2.5 for programs like this (the actual test was a benchmark called Optcarrot. The developers point out that the compiler is still experimental and many other memory-intensive workloads like Rails might not benefit from it at the moment.

The JIT compiler is also newsworthy because 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 JIT compiler is supported when Ruby is built by GCC, Clang, or Microsoft VC++, which needs to be available at runtime. 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. Another class that has been introduced is RubyVM::AbstractSyntaxTree::Node. This lets you get source location and children nodes from Node objects. This feature is experimental.

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. 

 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


Apache Lucene Improves Sparce Indexing
22/10/2024

Apache Lucene 10 has been released. The updated version adds a new IndexInput prefetch API, support for sparse indexing on doc values, and upgraded Snowball dictionaries resulting in improved tokeniza [ ... ]



Lightbend Announces Akka 3
15/11/2024

Lightbend, the company that developed Akka, has announced Akka 3, and has changed its name to Akka. The company produces cloud-native microservices frameworks, and Akka is used for building distribute [ ... ]


More News

espbook

 

Comments




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