From Fedora Project Wiki
mNo edit summary
m (Add trackers)
 
(8 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<!-- The actual name of your proposed change page should look something like: Changes/Your_Change_Proposal_Name.  This keeps all change proposals in the same namespace -->
<!-- The actual name of your proposed change page should look something like: Changes/Your_Change_Proposal_Name.  This keeps all change proposals in the same namespace -->


= Change Proposal Name =
= Ruby 3.1 =
Ruby 3.1


== Summary ==
== Summary ==
Line 22: Line 21:


== Current status ==
== Current status ==
[[Category:ChangePageIncomplete]]
[[Category:ChangeAcceptedF36]]
<!-- When your change proposal page is completed and ready for review and announcement -->
<!-- When your change proposal page is completed and ready for review and announcement -->
<!-- remove Category:ChangePageIncomplete and change it to Category:ChangeReadyForWrangler -->
<!-- remove Category:ChangePageIncomplete and change it to Category:ChangeReadyForWrangler -->
Line 39: Line 38:
ON_QA -> change is fully code complete
ON_QA -> change is fully code complete
-->
-->
* FESCo issue: <will be assigned by the Wrangler>
* [https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/thread/EPRSBLP6AWEC6TCF2TTNUEYQ6AOOYHMW/ devel thread]
* Tracker bug: <will be assigned by the Wrangler>
* FESCo issue: [https://pagure.io/fesco/issue/2727 #2727]
* Release notes tracker: <will be assigned by the Wrangler>
* Tracker bug: [https://bugzilla.redhat.com/show_bug.cgi?id=2040429 #2040429]
* Release notes tracker: [https://pagure.io/fedora-docs/release-notes/issue/787 #787]


== Detailed Description ==
== Detailed Description ==
Line 82: Line 82:
This gem is enabled by default. You can disable it by using a command-line option --disable-error_highlight. See the repository in detail.
This gem is enabled by default. You can disable it by using a command-line option --disable-error_highlight. See the repository in detail.


=== Irb improvement ===
=== IRB Autocomplete and Documentation Display ===
 
The IRB now has an autocomplete feature, where you can just type in the code, and the completion candidates dialog will appear. You can use Tab and Shift+Tab to move up and down.
 
If documentation is installed when you select a completion candidate, the documentation dialog will appear next to the completion candidates dialog, showing part of the content. You can read the full documentation by pressing Alt+d.


=== Other Notable New Features ===
=== Other Notable New Features ===
Line 89: Line 93:
** Values in Hash literals and keyword arguments can be omitted.
** Values in Hash literals and keyword arguments can be omitted.
** Pin operator in pattern matching now takes an expression.
** Pin operator in pattern matching now takes an expression.
** Parentheses can be omitted in one-line pattern matching.
* RBS
* RBS
** Generic type parameters can be bounded.
** Generic type aliases are supported.
** `rbs collection` has been introduced to manage gems’ RBSs.
** `rbs collection` has been introduced to manage gems’ RBSs.
** Many signatures for built-in and standard libraries have been added/updated.
** Many signatures for built-in and standard libraries have been added/updated.
Line 109: Line 116:
** foo[0], bar[0] = baz, qux was evaluated in order baz, qux, foo, and then bar in Ruby 3.0. In Ruby 3.1, it is evaluated in order foo, bar, baz, and then qux.
** foo[0], bar[0] = baz, qux was evaluated in order baz, qux, foo, and then bar in Ruby 3.0. In Ruby 3.1, it is evaluated in order foo, bar, baz, and then qux.
* Variable Width Allocation: Strings (experimental)
* Variable Width Allocation: Strings (experimental)
* Psych 4.0 changes Psych.load to use safe_load by default. You may need to use Psych 3.3.2 for migrating to this behavior.
* Standard libraries updates
* Standard libraries updates


Line 234: Line 242:
<!-- REQUIRED FOR SYSTEM WIDE CHANGES -->
<!-- REQUIRED FOR SYSTEM WIDE CHANGES -->
* [http://www.ruby-doc.org/ Help and documentation for the Ruby programming language]
* [http://www.ruby-doc.org/ Help and documentation for the Ruby programming language]
* [https://github.com/ruby/ruby/blob/v3_1_0_preview1/NEWS.md Ruby 3.1.0 NEWS]
* [https://github.com/ruby/ruby/blob/ruby_3_1/NEWS.md Ruby 3.1.0 NEWS]
* [https://www.ruby-lang.org/en/news/2021/11/09/ruby-3-1-0-preview1-released/ Ruby 3.1 release announcement]  
* [https://www.ruby-lang.org/en/news/2021/12/25/ruby-3-1-0-released/ Ruby 3.1 release announcement]  


== Release Notes ==
== Release Notes ==
Line 246: Line 254:
* The Ruby 3.1 bumps soname, therefore Ruby packages, which use binary extensions, should be rebuilt. Nevertheless, since upstream paid great attention to source compatibility, no changes to your code are needed.
* The Ruby 3.1 bumps soname, therefore Ruby packages, which use binary extensions, should be rebuilt. Nevertheless, since upstream paid great attention to source compatibility, no changes to your code are needed.


https://github.com/ruby/ruby/blob/v3_1_0_preview1/NEWS.md
https://github.com/ruby/ruby/blob/ruby_3_1/NEWS.md

Latest revision as of 17:02, 13 January 2022


Ruby 3.1

Summary

Ruby 3.1 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 3.0 in Fedora 35 to Ruby 3.1 in Fedora 36, Fedora becomes the superior Ruby development platform.

Owner


Current status

Detailed Description

Ruby 3.1 is upstream's new major release of Ruby. Many new features and improvements are included.

YJIT: New experimental in-process JIT compiler

Ruby 3.1 merges YJIT, a new in-process JIT compiler developed by Shopify.

Since Ruby 2.6 introduced MJIT in 2018, its performance greatly improved, and finally we achieved Ruby3x3 last year. But even though Optcarrot has shown impressive speedups, the JIT hasn’t benefited real world business applications.

Recently Shopify contributed many Ruby improvements to speed up their Rails application. YJIT is an important contribution, and aims to improve the performance of Rails applications.

Though MJIT is a method-based JIT compiler and uses an external C compiler, YJIT uses Basic Block Versioning and includes JIT compiler inside it. With Lazy Basic Block Versioning (LBBV) it first compiles the beginning of a method, and incrementally compiles the rest when the type of arguments and variables are dynamically determined. See YJIT: a basic block versioning JIT compiler for CRuby for a detailed introduction.

With this technology, YJIT achieves both fast warmup time and performance improvements on most real-world software, up to 22% on railsbench, 39% on liquid-render.

YJIT is still an experimental feature, and as such, it is disabled by default. If you want to use this, specify the --yjit command-line option to enable YJIT. It is also limited to macOS & Linux on x86-64 platforms for now.

   https://bugs.ruby-lang.org/issues/18229
   https://shopify.engineering/yjit-just-in-time-compiler-cruby
   https://www.youtube.com/watch?v=PBVLf3yfMs8

debug gem: A new debugger

A new debugger debug.gem is bundled. debug.gem is fast debugger implementation and it provides many features like remote debugging, colorful REPL, IDE (VSCode) integration and more. It replaces lib/debug.rb standard library.

error_highlight: Fine-grained error location in backtrace

A built-in gem, error_highlight, has been introduced. It includes fine-grained error location in backtrace:

$ ruby test.rb test.rb:1:in <main>': undefined method time' for 1:Integer (NoMethodError)

1.time {}

^^^^^

Did you mean? times

This gem is enabled by default. You can disable it by using a command-line option --disable-error_highlight. See the repository in detail.

IRB Autocomplete and Documentation Display

The IRB now has an autocomplete feature, where you can just type in the code, and the completion candidates dialog will appear. You can use Tab and Shift+Tab to move up and down.

If documentation is installed when you select a completion candidate, the documentation dialog will appear next to the completion candidates dialog, showing part of the content. You can read the full documentation by pressing Alt+d.

Other Notable New Features

  • Language
    • Values in Hash literals and keyword arguments can be omitted.
    • Pin operator in pattern matching now takes an expression.
    • Parentheses can be omitted in one-line pattern matching.
  • RBS
    • Generic type parameters can be bounded.
    • Generic type aliases are supported.
    • rbs collection has been introduced to manage gems’ RBSs.
    • Many signatures for built-in and standard libraries have been added/updated.
    • It includes many bug fixes and performance improvements too.
  • TypeProf
    • Experimental IDE support has been implemented.
    • Many bug fixes and performance improvements.

Performance improvements

  • MJIT
    • For workloads like Rails, the default --jit-max-cache is changed from 100 to 10000. The JIT compiler no longer skips compilation of methods longer than 1000 instructions.
    • To support Zeitwerk of Rails, JIT-ed code is no longer cancelled when a TracePoint for class events is enabled.

Other notable changes since 3.0

  • One-line pattern matching, e.g., ary => [x, y, z], is no longer experimental.
  • Multiple assignment evaluation order has been changed slightly.
    • foo[0], bar[0] = baz, qux was evaluated in order baz, qux, foo, and then bar in Ruby 3.0. In Ruby 3.1, it is evaluated in order foo, bar, baz, and then qux.
  • Variable Width Allocation: Strings (experimental)
  • Psych 4.0 changes Psych.load to use safe_load by default. You may need to use Psych 3.3.2 for migrating to this behavior.
  • Standard libraries updates

Feedback

Benefit to Fedora

With a latest release, Ruby language is supporting the newest language features, which enables even faster and easier development of Ruby applications.

Scope

  • Other developers:
    • Rebuild of packages with binary extensions (i.e. packages which depends on libruby) will be handled automatically, but some packages might need fixes/updates to support Ruby 3.1 properly.
  • Release engineering: #10478
    • The packages are going to be rebuild in side-tag, but that does not need releng involvement nowadays.
  • Policies and guidelines: N/A (not needed for this Change)
  • Trademark approval: N/A (not needed for this Change)
  • Alignment with Objectives:

Upgrade/compatibility impact

  • User specific Ruby binary extensions need to be rebuild.
  • Ruby packages/application dependencies might need to be adjusted if net-* and other newly bundled gems are used.

How To Test

  • No special hardware is needed.
  • To test, install Ruby 3.1. The test builds are pusblished in PR or on Ruby-SIG ML
  • Try to locally rebuild your packages using Ruby 3.1.
  • Use the packages with your applications previously written in Ruby.
  • If something doesn't work as it should, let us know.

User Experience

The Ruby programs/scripts should behave as they were used to.

Dependencies

$ dnf repoquery --disablerepo=* --enablerepo=rawhide --enablerepo=rawhide-source --arch=src --whatrequires 'ruby-devel' | sort | uniq | wc -l
130

Contingency Plan

  • Contingency mechanism: We would like to get a special buildroot tag to be able to rebuild necessary the packages with Ruby 3.1. If anything goes wrong, the tag could be easily dropped and previous version of Ruby 3.0 and its dependencies stays intact. The tag would be merged into F36 after everything is rebuild.
  • Contingency deadline: Mass Rebuild
  • Blocks release? No


Documentation

Release Notes

  • The Ruby 3.1 bumps soname, therefore Ruby packages, which use binary extensions, should be rebuilt. Nevertheless, since upstream paid great attention to source compatibility, no changes to your code are needed.

https://github.com/ruby/ruby/blob/ruby_3_1/NEWS.md