Ruby 2.6 is the latest stable version of Ruby. Many new features and improvements are included for the increasingly diverse and expanding demands for Ruby. With this major update from Ruby 2.5 in Fedora 29 to Ruby 2.6 in Fedora 30, Fedora becomes the superior Ruby development platform.
Notable changes include:
An initial implementation of a Just-In-Time (JIT) compiler is now available. The JIT compiler aims to improve performance of any Ruby program execution. Unlike ordinary JIT compilers for other languages, Ruby’s JIT compiler does JIT compilation in a unique way, which prints C code to a disk and spawns common C compiler process to generate native code.
The main purpose of this JIT release is to provide a chance to check if it works for your platform and to find out security risks before the 2.6 release. JIT compiler is supported when Ruby is built by GCC, Clang, or Microsoft VC++, which needs to be available on runtime. Otherwise you can’t use it for now.
As of Ruby 2.6.0 preview3, we achieved 1.7x faster performance than Ruby 2.5 on CPU-intensive non-trivial benchmark workload called Optcarrot. The performance on memory-intensive workload like Rails application are going to be improved as well.
RubyVM::ASTexperimental module is now available. This module has a
parsemethod which parses a given ruby code of string and returns AST (Abstract Syntax Tree) nodes, and a
parse_filemethod which parses a given ruby code file and returns AST nodes. A
RubyVM::AST::Nodeclass is also introduced. You can get location information and children nodes from Node objects. This feature is experimental. Compatibility of the structure of AST nodes are not guaranteed.
Add a new alias
Binding#source_location. This method returns the source location of binding, a 2-element array of
:exceptionoption to let
Kernel.#systemraise an error instead of returning false.
rescuenow causes a syntax error. [EXPERIMENTAL]
Constant names may start with a non-ASCII capital letter.
An endless range,
(1..), is introduced. It works as if it has no end.
The following performance improvements have been made:
Proc#callbecause we don’t need to care about
$SAFEany more. The
lc_fizzbuzzbenchmark shows a 40% speed improvement.
block.callwhere block is passed block parameter. Ruby 2.6 improves the performance of passed block calling. There can observed 2.6x improvement with micro-benchmarks.
Transient Heap (
theap) has been introduced.
theapis managed heap for short-living memory objects which are pointed by specific classes. For example, making small and short-living Hash object is twice as fast. With the
rdocbenchmark, 6-7% performance improvement is observed.
Other notable changes since version 2.5:
$SAFEis a process global state and we can set 0 again.
eoutvararguments are now keyword arguments.
Merged RubyGems 3.0.0.beta2.
Merge Bundler as default gem.
See the upstream release announcement for more detailed information about this release.