Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Ruby 3.0.3 → 3.1.6 #142

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Update Ruby 3.0.3 → 3.1.6 #142

wants to merge 1 commit into from

Conversation

depfu[bot]
Copy link
Contributor

@depfu depfu bot commented May 31, 2024

Here is everything you need to know about this upgrade. Please take a good look at what changed and the test results before merging this pull request.

What changed?

Release Notes

3.1.6

3.1.5

3.1.4

3.1.3

Posted by nagachika on 24 Nov 2022

Ruby 3.1.3 has been released.

This release includes a security fix. Please check the topics below for details.

This release also includes a fix for build failure with Xcode 14 and macOS 13 (Ventura). See the related ticket for more details.

See the commit logs for further details.

3.1.2

Posted by naruse and mame on 12 Apr 2022

Ruby 3.1.2 has been released.

This release includes security fixes. Please check the topics below for details.

See the commit logs for further details.

3.1.1

Posted by naruse on 18 Feb 2022

Ruby 3.1.1 has been released.

This is the first TEENY version release of the stable 3.1 series.

See the commit logs for details.

3.1.0

Posted by naruse on 25 Dec 2021

We are pleased to announce the release of Ruby 3.1.0. Ruby 3.1 keeps compatibility with Ruby 3.0 and also adds many features.

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 Unix-like 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 completely rewritten debugger debug.gem is bundled. debug.gem has the following features:

  • Improve the debugging performance (it does not slow down the application even with the debugger)
  • Support remote debugging
  • Support rich debugging frontend (VSCode and Chrome browser are supported now)
  • Support multi-process/multi-thread debugging
  • Colorful REPL
  • And other useful features like recod & replay feature, tracing feature and so on.

Ruby had bundled lib/debug.rb, but it was not well maintained and it had issues about performance and features. debug.gem replaced lib/debug.rb completely.

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

Currently, only NameError is supported.

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 Document 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 documents are 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 document by pressing Alt+d.

Other Notable New Features

Language

  • Values in Hash literals and keyword arguments can be omitted. [Feature #14579]
    • {x:, y:} is a syntax sugar of {x: x, y: y}.
    • foo(x:, y:) is a syntax sugar of foo(x: x, y: y).
  • Pin operator in pattern matching now takes an expression. [Feature #17411]
Prime.each_cons(2).lazy.find_all{_1 in [n, ^(n + 2)]}.take(3).to_a
#=> [[3, 5], [5, 7], [11, 13]]
  • Parentheses can be omitted in one-line pattern matching. [Feature #16182]
[0, 1] => _, x
{y: 2} => y:
x #=> 1
y #=> 2

RBS

RBS is a language to describe the structure of Ruby programs. See the repository for details.

Updates since Ruby 3.0.0:

  • Generic type parameters can be bounded. (PR)
  • Generic type aliases are supported. (PR)
  • rbs collection has been introduced to manage gems’ RBSs. (doc)
  • Many signatures for built-in and standard libraries have been added/updated.
  • It includes many bug fixes and performance improvements too.

See the CHANGELOG.md for more information.

TypeProf

TypeProf is a static type analyzer for Ruby. It generates a prototype of RBS from non-type-annotated Ruby code. See the document for detail.

The main updates since Ruby 3.0.0 is an experimental IDE support called “TypeProf for IDE”.

Demo of TypeProf for IDE

The vscode extension shows a guessed (or explicitly written in a RBS file) method signature above each method definition, draws a red underline under the code that may cause a name error or type error, and completes method names (i.e., shows method candidates). See the document in detail.

Also, the release includes 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. [Bug #4443]
    • 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) [Bug #18239]

  • Psych 4.0 changes Psych.load as safe_load by the default. You may need to use Psych 3.3.2 for migrating to this behavior. [Bug #17866]

Standard libraries updates

  • The following default gem are updated.
    • RubyGems 3.3.3
    • base64 0.1.1
    • benchmark 0.2.0
    • bigdecimal 3.1.1
    • bundler 2.3.3
    • cgi 0.3.1
    • csv 3.2.2
    • date 3.2.2
    • did_you_mean 1.6.1
    • digest 3.1.0
    • drb 2.1.0
    • erb 2.2.3
    • error_highlight 0.3.0
    • etc 1.3.0
    • fcntl 1.0.1
    • fiddle 1.1.0
    • fileutils 1.6.0
    • find 0.1.1
    • io-console 0.5.10
    • io-wait 0.2.1
    • ipaddr 1.2.3
    • irb 1.4.1
    • json 2.6.1
    • logger 1.5.0
    • net-http 0.2.0
    • net-protocol 0.1.2
    • nkf 0.1.1
    • open-uri 0.2.0
    • openssl 3.0.0
    • optparse 0.2.0
    • ostruct 0.5.2
    • pathname 0.2.0
    • pp 0.3.0
    • prettyprint 0.1.1
    • psych 4.0.3
    • racc 1.6.0
    • rdoc 6.4.0
    • readline 0.0.3
    • readline-ext 0.1.4
    • reline 0.3.0
    • resolv 0.2.1
    • rinda 0.1.1
    • ruby2_keywords 0.0.5
    • securerandom 0.1.1
    • set 1.0.2
    • stringio 3.0.1
    • strscan 3.0.1
    • tempfile 0.1.2
    • time 0.2.0
    • timeout 0.2.0
    • tmpdir 0.1.2
    • un 0.2.0
    • uri 0.11.0
    • yaml 0.2.0
    • zlib 2.1.1
  • The following bundled gems are updated.
    • minitest 5.15.0
    • power_assert 2.0.1
    • rake 13.0.6
    • test-unit 3.5.3
    • rexml 3.2.5
    • rbs 2.0.0
    • typeprof 0.21.1
  • The following default gems are now bundled gems. You need to add the following libraries to Gemfile under the bundler environment.
    • net-ftp 0.1.3
    • net-imap 0.2.2
    • net-pop 0.1.1
    • net-smtp 0.3.1
    • matrix 0.4.2
    • prime 0.1.2
    • debug 1.4.0

See NEWS or commit logs for more details.

With those changes, 3124 files changed, 551760 insertions(+), 99167 deletions(-) since Ruby 3.0.0!

Merry Christmas, Happy Holidays, and enjoy programming with Ruby 3.1!


All Depfu comment commands
@​depfu refresh
Rebases against your default branch and redoes this update
@​depfu recreate
Recreates this PR, overwriting any edits that you've made to it
@​depfu merge
Merges this PR once your tests are passing and conflicts are resolved
@​depfu close
Closes this PR and deletes the branch
@​depfu reopen
Restores the branch and reopens this PR (if it's closed)
@​depfu pause
Pauses all engine updates and closes this PR

@depfu depfu bot added the depfu label May 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

0 participants