Skip to content

Commit 91fb4a6

Browse files
authored
Merge pull request #2776 from stomar/improve-3-1-0
Improve 3.1.0 post (en)
2 parents 8326113 + 4d05db7 commit 91fb4a6

File tree

1 file changed

+27
-28
lines changed

1 file changed

+27
-28
lines changed

en/news/_posts/2021-12-25-ruby-3-1-0-released.md

Lines changed: 27 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -14,43 +14,42 @@ We are pleased to announce the release of Ruby {{ release.version }}. Ruby 3.1 k
1414

1515
## YJIT: New experimental in-process JIT compiler
1616

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

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.
2120

2221
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.
2322

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.
2524

2625
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.
2726

2827
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.
2928

30-
* https://bugs.ruby-lang.org/issues/18229
31-
* https://shopify.engineering/yjit-just-in-time-compiler-cruby
32-
* https://www.youtube.com/watch?v=PBVLf3yfMs8
29+
* [https://bugs.ruby-lang.org/issues/18229](https://bugs.ruby-lang.org/issues/18229)
30+
* [https://shopify.engineering/yjit-just-in-time-compiler-cruby](https://shopify.engineering/yjit-just-in-time-compiler-cruby)
31+
* [https://www.youtube.com/watch?v=PBVLf3yfMs8](https://www.youtube.com/watch?v=PBVLf3yfMs8)
3332

3433
## debug gem: A new debugger
3534

3635
A completely rewritten debugger [debug.gem](https://github.com/ruby/debug) is bundled. debug.gem has the following features:
3736

38-
* Improve the debugging performance (it does not slow down the application even with the debugger)
39-
* Support remote debugging
40-
* Support rich debugging frontend (VSCode and Chrome browser are supported now)
41-
* Support multi-process/multi-thread debugging
42-
* Colorful REPL
37+
* Improve the debugging performance (it does not slow down the application even with the debugger).
38+
* Support remote debugging.
39+
* Support rich debugging frontend (VS Code and Chrome browser are supported currently).
40+
* Support multi-process/multi-thread debugging.
41+
* Colorful REPL.
4342
* And other useful features like record & replay feature, tracing feature and so on.
4443

4544
<video autoplay="autoplay" controls="controls" muted="muted" width="764" height="510" poster="https://cache.ruby-lang.org/pub/media/ruby310_debug_demo.jpg">
4645
<source src="https://cache.ruby-lang.org/pub/media/ruby310_debug_demo.mp4" type="video/mp4">
4746
</video>
4847

49-
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.
5049

5150
## error_highlight: Fine-grained error location in backtrace
5251

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:
5453

5554
```
5655
$ ruby test.rb
@@ -63,13 +62,13 @@ Did you mean? times
6362

6463
Currently, only `NameError` is supported.
6564

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.
6766

68-
## IRB Autocomplete and Document Display
67+
## IRB Autocomplete and Documentation Display
6968

7069
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.
7170

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.
7372

7473
<video autoplay="autoplay" controls="controls" muted="muted" width="764" height="510" poster="https://cache.ruby-lang.org/pub/media/ruby310_irb_dialog.png">
7574
<source src="https://cache.ruby-lang.org/pub/media/ruby310_irb_dialog.mp4" type="video/mp4">
@@ -80,10 +79,10 @@ If documents are installed when you select a completion candidate, the documenta
8079
### Language
8180

8281
* Values in Hash literals and keyword arguments can be omitted. [Feature #14579]
83-
* `{x:, y:}` is a syntax sugar of `{x: x, y: y}`.
84-
* `foo(x:, y:)` is a syntax sugar of `foo(x: x, y: y)`.
82+
* `{x:, y:}` is syntax sugar for `{x: x, y: y}`.
83+
* `foo(x:, y:)` is syntax sugar for `foo(x: x, y: y)`.
8584

86-
* Pin operator in pattern matching now takes an expression. [Feature #17411]
85+
* The pin operator (`^`) in pattern matching now takes an expression. [Feature #17411]
8786

8887
```ruby
8988
Prime.each_cons(2).lazy.find_all{_1 in [n, ^(n + 2)]}.take(3).to_a
@@ -101,7 +100,7 @@ y #=> 2
101100

102101
### RBS
103102

104-
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.
105104

106105
Updates since Ruby 3.0.0:
107106

@@ -111,17 +110,17 @@ Updates since Ruby 3.0.0:
111110
* Many signatures for built-in and standard libraries have been added/updated.
112111
* It includes many bug fixes and performance improvements too.
113112

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.
115114

116115
### TypeProf
117116

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.
119118

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".
121120

122121
![Demo of TypeProf for IDE](https://cache.ruby-lang.org/pub/media/ruby310_typeprof_ide_demo.png)
123122

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.
125124

126125
Also, the release includes many bug fixes and performance improvements.
127126

@@ -138,15 +137,15 @@ Also, the release includes many bug fixes and performance improvements.
138137
* One-line pattern matching, e.g., `ary => [x, y, z]`, is no longer experimental.
139138
* Multiple assignment evaluation order has been changed slightly. [[Bug #4443]](https://bugs.ruby-lang.org/issues/4443)
140139
* `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`.
141-
* Variable Width Allocation: Strings (experimental) [[Bug #18239]](https://bugs.ruby-lang.org/issues/18239)
140+
* Variable Width Allocation: Strings (experimental). [[Bug #18239]](https://bugs.ruby-lang.org/issues/18239)
142141

143-
* Psych 4.0 changes `Psych.load` as `safe_load` by the default.
142+
* Psych 4.0 changes `Psych.load` to use `safe_load` by default.
144143
You may need to use Psych 3.3.2 for migrating to this behavior.
145144
[[Bug #17866]](https://bugs.ruby-lang.org/issues/17866)
146145

147146
### Standard libraries updates
148147

149-
* The following default gem are updated.
148+
* The following default gems are updated.
150149
* RubyGems 3.3.3
151150
* base64 0.1.1
152151
* benchmark 0.2.0
@@ -220,7 +219,7 @@ Also, the release includes many bug fixes and performance improvements.
220219
* debug 1.4.0
221220

222221
See [NEWS](https://github.com/ruby/ruby/blob/{{ release.tag }}/NEWS.md)
223-
or [commit logs](https://github.com/ruby/ruby/compare/v3_0_0...{{ release.tag }})
222+
or the [commit logs](https://github.com/ruby/ruby/compare/v3_0_0...{{ release.tag }})
224223
for more details.
225224

226225
With those changes, [{{ release.stats.files_changed }} files changed, {{ release.stats.insertions }} insertions(+), {{ release.stats.deletions }} deletions(-)](https://github.com/ruby/ruby/compare/v3_0_0...{{ release.tag }}#file_bucket)

0 commit comments

Comments
 (0)