InfoQ Homepage News Ruby 2.5.0 Overview
Ruby 2.5.0 Overview
Leia em PortuguÃas
This item in japanese
Jan 25, 2018 1 min read
by
Write for InfoQ
Feed your curiosity. Help 550k+ globalsenior developers
each month stay ahead.Get in touch
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.
This content is in the Ruby topic
Related Topics:
-
Related Editorial
-
Related Sponsors
-
Popular across InfoQ
-
TanStack Start: A New Meta Framework Powered by React or SolidJS
-
Microsoft Patches Critical ASP.NET Core Vulnerability with 9.9 Severity Score
-
GitHub Expands Copilot Ecosystem with AgentHQ
-
Redis Critical Remote Code Execution Vulnerability Discovered after 13 Years
-
Monzo’s Real-Time Fraud Detection Architecture with BigQuery and Microservices
-
Architecture Should Model the World as It Really Is: A Conversation with Randy Shoup
-
Related Content
The InfoQ Newsletter
A round-up of last week’s content on InfoQ sent out every Tuesday. Join a community of over 250,000 senior developers. View an example