You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: en/news/_posts/2021-12-25-ruby-3-1-0-released.md
+27-28Lines changed: 27 additions & 28 deletions
Original file line number
Diff line number
Diff line change
@@ -14,43 +14,42 @@ We are pleased to announce the release of Ruby {{ release.version }}. Ruby 3.1 k
14
14
15
15
## YJIT: New experimental in-process JIT compiler
16
16
17
-
18
17
Ruby 3.1 merges YJIT, a new in-process JIT compiler developed by Shopify.
19
18
20
-
Since [Ruby 2.6 introduced MJIT in 2018](https://www.ruby-lang.org/en/news/2018/12/25/ruby-2-6-0-released/), its performance greatly improved, and finally [we achieved Ruby3x3 last year](https://www.ruby-lang.org/en/news/2020/12/25/ruby-3-0-0-released/). But even though Optcarrot has shown impressive speedups, the JIT hasn't benefited real world business applications.
19
+
Since [Ruby 2.6 introduced MJIT in 2018](https://www.ruby-lang.org/en/news/2018/12/25/ruby-2-6-0-released/), its performance greatly improved, and finally [we achieved Ruby3x3 last year](https://www.ruby-lang.org/en/news/2020/12/25/ruby-3-0-0-released/). But even though the Optcarrot benchmark has shown impressive speedups, the JIT has not benefited real world business applications.
21
20
22
21
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.
23
22
24
-
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](https://dl.acm.org/doi/10.1145/3486606.3486781) for a detailed introduction.
23
+
While MJIT is a method-based JIT compiler and uses an external C compiler, YJIT uses Basic Block Versioning and includes a 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](https://dl.acm.org/doi/10.1145/3486606.3486781) for a detailed introduction.
25
24
26
25
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.
27
26
28
27
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.
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.
48
+
Ruby had bundled lib/debug.rb, but it was not well maintained and it had issues about performance and features. debug.gem replaces lib/debug.rb completely.
50
49
51
50
## error_highlight: Fine-grained error location in backtrace
52
51
53
-
A built-in gem, error_highlight, has been introduced. It includes fine-grained error location in backtrace:
52
+
A built-in gem, error_highlight, has been introduced. It includes fine-grained error location in backtraces:
54
53
55
54
```
56
55
$ ruby test.rb
@@ -63,13 +62,13 @@ Did you mean? times
63
62
64
63
Currently, only `NameError` is supported.
65
64
66
-
This gem is enabled by default. You can disable it by using a command-line option `--disable-error_highlight`. See [the repository](https://github.com/ruby/error_highlight)in detail.
65
+
This gem is enabled by default. You can disable it by using the command-line option `--disable-error_highlight`. See the [error_highlight repository](https://github.com/ruby/error_highlight)for details.
67
66
68
-
## IRB Autocomplete and Document Display
67
+
## IRB Autocomplete and Documentation Display
69
68
70
69
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.
71
70
72
-
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.
71
+
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.
RBS is a language to describe the structure of Ruby programs. See [the repository](https://github.com/ruby/rbs) for details.
103
+
RBS is a language to describe the structure of Ruby programs. See the[RBS repository](https://github.com/ruby/rbs) for details.
105
104
106
105
Updates since Ruby 3.0.0:
107
106
@@ -111,17 +110,17 @@ Updates since Ruby 3.0.0:
111
110
* Many signatures for built-in and standard libraries have been added/updated.
112
111
* It includes many bug fixes and performance improvements too.
113
112
114
-
See [the CHANGELOG.md](https://github.com/ruby/rbs/blob/master/CHANGELOG.md) for more information.
113
+
See the [RBS changelog](https://github.com/ruby/rbs/blob/master/CHANGELOG.md) for more information.
115
114
116
115
### TypeProf
117
116
118
-
TypeProf is a static type analyzer for Ruby. It generates a prototype of RBS from non-type-annotated Ruby code. See [the document](https://github.com/ruby/typeprof/blob/master/doc/doc.md) for detail.
117
+
TypeProf is a static type analyzer for Ruby. It generates a prototype of RBS from non-type-annotated Ruby code. See the [documentation](https://github.com/ruby/typeprof/blob/master/doc/doc.md) for details.
119
118
120
-
The main updates since Ruby 3.0.0 is an experimental IDE support called "TypeProf for IDE".
119
+
The main update since Ruby 3.0.0 is an experimental IDE support called "TypeProf for IDE".
121
120
122
121

123
122
124
-
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](https://github.com/ruby/typeprof/blob/master/doc/ide.md)in detail.
123
+
The VS Code extension shows a guessed (or explicitly written in an 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 [documentation](https://github.com/ruby/typeprof/blob/master/doc/ide.md)for details.
125
124
126
125
Also, the release includes many bug fixes and performance improvements.
127
126
@@ -138,15 +137,15 @@ Also, the release includes many bug fixes and performance improvements.
138
137
* One-line pattern matching, e.g., `ary => [x, y, z]`, is no longer experimental.
139
138
* Multiple assignment evaluation order has been changed slightly. [[Bug #4443]](https://bugs.ruby-lang.org/issues/4443)
140
139
*`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`.
0 commit comments