Ruby

Ruby 2.6

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.

Серед помітних змін:

  • 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.

  • A new RubyVM::AST experimental module is now available. This module has a parse method which parses a given ruby code of string and returns AST (Abstract Syntax Tree) nodes, and a parse_file method which parses a given ruby code file and returns AST nodes. A RubyVM::AST::Node class 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.

  • New features:

    • Add a new alias then to Kernel#yield_self.

    • Add Random.bytes.

    • Add Binding#source_location. This method returns the source location of binding, a 2-element array of FILE and LINE.

    • Add :exception option to let Kernel.#system raise an error instead of returning false.

    • else without rescue now 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:

  • Sped up Proc#call because we don’t need to care about $SAFE any more. The lc_fizzbuzz benchmark shows a 40% speed improvement.

  • Sped up block.call where 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. theap is 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 rdoc benchmark, 6-7% performance improvement is observed.

Other notable changes since version 2.5:

  • $SAFE is a process global state and we can set 0 again.

  • Passing safe_level to ERB.new is deprecated. trim_mode and eoutvar arguments 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.