What to expect in Ruby 2.6
Ruby, one of the more venerable dynamic languages, now has available the first beta release of Version 2.6.
Ruby 2.6.0’s first beta is now available, featuring what its creators describe as a unique twist in just-in-time compilation: the implementation prints the C code to disk and a C compiler process is produced to generate native code.
This first beta provides just the infrastructure for just-in-time compilation, with very few optimisations. The Ruby team is verifying compiler compatibility with various platforms and trying to find security risks before the production release of Ruby 2.6. In the beta, just-in-time compilation is supported only when a Ruby app is built by the GCC compiler or Clang and the compiler is available at runtime. Plans call for implementing method in-lining in the compiler, to significantly increase performance. Support for Microsoft’s Visual Studio IDE is planned as well.
Other features in the beta include:
- In a change to the language, $SAFE is a process global state and 0 can be set again.
- Improved performance of block-passing and passed block calling.
- Proc#call has been sped up.
- The bytes method has been added.
- Where to download the Ruby 2.6 beta
You can download the Ruby 2.6 beta from the Ruby project web site.
Arriving on Christmas Day 2017, Ruby 2.5.0 is the first stable release in the 2.5 series.
It boosts performance by 5 to 10% by removing trace instructions from bytecode that has been found to be overhead. A dynamic instrumentation technique is used instead. Also, block passing by a block parameter has been made three times faster than it was in Ruby 2.4, through use of the Lazy Proc allocation technique.
Other features that improve performance include:
- Document generation has been boosted by switching from the legacy lexical analyser from IRB to Ripper.
- The Mutex class has been rewritten to make it smaller and faster. Mutex can be used to manage access to shared data from concurrent threads.
- ERB generates code from a template at twice the speed as version 2.4.
- Performance has been improved in built-in methods including Array#concat, Enumerable#sort_by, and String#concat.
Other improvements in Ruby 2.5 include:
- Struct/new can create classes that accept keyword arguments.
- Do/end blocks will now work directly with ensure/rescue/else.
- The pp.rb library loads automatically.
- An option has been added to print backtrace in reverse order. The intent is to get the main error message without needing to scroll.
- To improve testing, support is offered for branch and method coverage measurement. Branch coverage reveals which branches are executed, while method coverage indicates which methods are invoked.
Ruby 2.5 also features a bug fix in which the SecureRandom library, for generating random numbers, which now prefers OS-provided sources over OpenSSL. Also, standard libraries such as cmath, csv, date, dbm, and ipaddr have been promoted to gems.
IDG News Service