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.
Opvallende veranderingen zijn onder meer:
-
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 aparse
method which parses a given ruby code of string and returns AST (Abstract Syntax Tree) nodes, and aparse_file
method which parses a given ruby code file and returns AST nodes. ARubyVM::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
toKernel#yield_self
. -
Add
Random.bytes
. -
Add
Binding#source_location
. This method returns the source location of binding, a 2-element array ofFILE
andLINE
. -
Add
:exception
option to letKernel.#system
raise an error instead of returning false. -
else
withoutrescue
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. Thelc_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 therdoc
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
toERB.new
is deprecated.trim_mode
andeoutvar
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.
Want to help? Learn how to contribute to Fedora Docs ›