BT

Ruby 2.5.0 Overview

| by Alex Giamas Follow 9 Followers on Jan 25, 2018. Estimated reading time: 1 minute |

Following the Christmas tradition for a sixth year in a row, a new major release of Ruby was released on December 25th. Ruby 2.5.0 features performance enhancements, improvements to Struct initialisation, the ability to print stacktraces in reverse order and more, and several common libraries have been promoted to default gems.

Ruby 2.5.0 features several performance related improvements with the most notable being removing all trace instructions from bytecode, thus improving performance by 5-10%. Trace instructions were added to support TracePoint, however in most cases TracePoint wasn’t used, adding pure overhead. Ruby now supports a dynamic instrumentation technique. Other performance related improvements include three times faster block passing as a block parameter and two times faster ERB code generation from templates. Performance has also been improved for built in functions like Array#concat, String#concat and Enumerable#sort_by and the Mutex class used in multithreading.

Aside from performance improvements, Struct.new can now create classes that accept keyword arguments and do/end blocks can work directly with ensure/rescue/else flows.

On library support, the following standard libraries cmath, csv, date, dbm, etc, fcntl, fiddle, fileutils, gdbm, ipaddr, scanf, sdbm, stringio, strscan, webrick, zlib have been promoted to default gems, while the favorite pp command now comes built-in with ruby eliminating the need for "require ‘pp’ " -- which is one of the most commonly written lines of code in Ruby.

Ruby developers now have the option to print stacktrace in reverse order, the intent being to reveal the main error message on top instead of the bottom of the trace. This feature is experimental and may be removed at a later release. Branch and method coverage measurement is also supported, allowing for better performance testing around invocations of different methods and branches during code execution.

Top level constant lookup has now been completely deprecated, emitting an error instead of a warning. yield_self has been added to yield a given block in its context and unlike tap, also return the block result, which can be useful for object chaining.

Ruby 2.5.0 can be downloaded from the official site.

Rate this Article

Adoption Stage
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread
Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Discuss

Login to InfoQ to interact with what matters most to you.


Recover your password...

Follow

Follow your favorite topics and editors

Quick overview of most important highlights in the industry and on the site.

Like

More signal, less noise

Build your own feed by choosing topics you want to read about and editors you want to hear from.

Notifications

Stay up-to-date

Set up your notifications and don't miss out on content that matters to you

BT