Skip to content

Commit b467d3a

Browse files
committed
Copy {en/ko}/news/_posts/2023-12-25-ruby-3-3-0-released.md
1 parent f668985 commit b467d3a

File tree

1 file changed

+305
-0
lines changed

1 file changed

+305
-0
lines changed
Lines changed: 305 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,305 @@
1+
---
2+
layout: news_post
3+
title: "Ruby 3.3.0 Released"
4+
author: "naruse"
5+
translator:
6+
date: 2023-12-25 00:00:00 +0000
7+
lang: en
8+
---
9+
10+
{% assign release = site.data.releases | where: "version", "3.3.0" | first %}
11+
We are pleased to announce the release of Ruby {{ release.version }}. Ruby 3.3 adds a new parser named Prism, uses Lrama as a parser generator, adds a new pure-Ruby JIT compiler named RJIT, and many performance improvements especially YJIT.
12+
13+
## Prism
14+
15+
* Introduced [the Prism parser](https://github.com/ruby/prism) as a default gem
16+
* Prism is a portable, error tolerant, and maintainable recursive descent parser for the Ruby language
17+
* Prism is production ready and actively maintained, you can use it in place of Ripper
18+
* There is [extensive documentation](https://ruby.github.io/prism/) on how to use Prism
19+
* Prism is both a C library that will be used internally by CRuby and a Ruby gem that can be used by any tooling which needs to parse Ruby code
20+
* Notable methods in the Prism API are:
21+
* `Prism.parse(source)` which returns the AST as part of a parse result object
22+
* `Prism.parse_comments(source)` which returns the comments
23+
* `Prism.parse_success?(source)` which returns true if there are no errors
24+
* You can make pull requests or issues directly on [the Prism repository](https://github.com/ruby/prism) if you are interested in contributing
25+
* You can now use `ruby --parser=prism` or `RUBYOPT="--parser=prism"` to experiment with the Prism compiler. Please note that this flag is for debugging only.
26+
27+
## Use Lrama instead of Bison
28+
29+
* Replace Bison with [Lrama LALR parser generator](https://github.com/ruby/lrama) [[Feature #19637]](https://bugs.ruby-lang.org/issues/19637)
30+
* If you have interest, please see [The future vision of Ruby Parser](https://rubykaigi.org/2023/presentations/spikeolaf.html)
31+
* Lrama internal parser is replaced with LR parser generated by Racc for maintainability
32+
* Parameterizing Rules `(?, *, +)` are supported, it will be used in Ruby parse.y
33+
34+
## YJIT
35+
36+
* Major performance improvements over Ruby 3.2
37+
* Support for splat and rest arguments has been improved.
38+
* Registers are allocated for stack operations of the virtual machine.
39+
* More calls with optional arguments are compiled. Exception handlers are also compiled.
40+
* Unsupported call types and megamorphic call sites no longer exit to the interpreter.
41+
* Basic methods like Rails `#blank?` and
42+
[specialized `#present?`](https://github.com/rails/rails/pull/49909) are inlined.
43+
* `Integer#*`, `Integer#!=`, `String#!=`, `String#getbyte`,
44+
`Kernel#block_given?`, `Kernel#is_a?`, `Kernel#instance_of?`, and `Module#===`
45+
are specially optimized.
46+
* Compilation speed is now slightly faster than Ruby 3.2.
47+
* Now more than 3x faster than the interpreter on Optcarrot!
48+
* Significantly improved memory usage over Ruby 3.2
49+
* Metadata for compiled code uses a lot less memory.
50+
* `--yjit-call-threshold` is automatically raised from 30 to 120
51+
when the application has more than 40,000 ISEQs.
52+
* `--yjit-cold-threshold` is added to skip compiling cold ISEQs.
53+
* More compact code is generated on Arm64.
54+
* Code GC is now disabled by default
55+
* `--yjit-exec-mem-size` is treated as a hard limit where compilation of new code stops.
56+
* No sudden drops in performance due to code GC.
57+
Better copy-on-write behavior on servers reforking with
58+
[Pitchfork](https://github.com/shopify/pitchfork).
59+
* You can still enable code GC if desired with `--yjit-code-gc`
60+
* Add `RubyVM::YJIT.enable` that can enable YJIT at run-time
61+
* You can start YJIT without modifying command-line arguments or environment variables.
62+
Rails 7.2 will [enable YJIT by default](https://github.com/rails/rails/pull/49947)
63+
using this method.
64+
* This can also be used to enable YJIT only once your application is
65+
done booting. `--yjit-disable` can be used if you want to use other
66+
YJIT options while disabling YJIT at boot.
67+
* More YJIT stats are available by default
68+
* `yjit_alloc_size` and several more metadata-related stats are now available by default.
69+
* `ratio_in_yjit` stat produced by `--yjit-stats` is now available in release builds,
70+
a special stats or dev build is no longer required to access most stats.
71+
* Add more profiling capabilities
72+
* `--yjit-perf` is added to facilitate profiling with Linux perf.
73+
* `--yjit-trace-exits` now supports sampling with `--yjit-trace-exits-sample-rate=N`
74+
* More thorough testing and multiple bug fixes
75+
76+
## RJIT
77+
78+
* Introduced a pure-Ruby JIT compiler RJIT and replaced MJIT.
79+
* RJIT supports only x86-64 architecture on Unix platforms.
80+
* Unlike MJIT, it doesn't require a C compiler at runtime.
81+
* RJIT exists only for experimental purposes.
82+
* You should keep using YJIT in production.
83+
* If you are interested in developing JIT for Ruby, please check out [k0kubun's presentation on Day 3 of RubyKaigi](https://rubykaigi.org/2023/presentations/k0kubun.html#day3).
84+
85+
## M:N thread scheduler
86+
87+
* M:N thread scheduler was introduced. [[Feature #19842]](https://bugs.ruby-lang.org/issues/19842)
88+
* M Ruby threads are managed by N native threads (OS threads) so the thread creation and management cost are reduced.
89+
* It can break C-extension compatibility so that M:N thread scheduler is disabled on the main Ractor by default.
90+
* `RUBY_MN_THREADS=1` environment variable enables M:N threads on the main Ractor.
91+
* M:N threads are always enabled on non-main Ractors.
92+
* `RUBY_MAX_CPU=n` environment variable sets maximum number of `N` (maximum number of native threads). The default value is 8.
93+
* Since only one Ruby thread per Ractor can run at the same time, the number of native threads will be used, which is the smaller of the number specified in `RUBY_MAX_CPU` and the number of running Ractors. So that single Ractor applications (most of applications) will only use 1 native thread.
94+
* To support blocking operations, more than `N` native threads can be used.
95+
96+
## Performance improvements
97+
98+
* `defined?(@ivar)` is optimized with Object Shapes.
99+
* Name resolution such as `Socket.getaddrinfo` can now be interrupted (in environments where pthreads are available). [[Feature #19965]](https://bugs.ruby-lang.org/issues/19965)
100+
* Several performance improvements to the Garbage Collector
101+
* Young objects referenced by old objects are no longer immediately
102+
promoted to the old generation. This significantly reduces the frequency of
103+
major GC collections. [[Feature #19678]](https://bugs.ruby-lang.org/issues/19678)
104+
* A new `REMEMBERED_WB_UNPROTECTED_OBJECTS_LIMIT_RATIO` tuning variable was
105+
introduced to control the number of unprotected objects cause a major GC
106+
collection to trigger. The default is set to `0.01` (1%). This significantly
107+
reduces the frequency of major GC collection. [[Feature #19571]](https://bugs.ruby-lang.org/issues/19571)
108+
* Write Barriers were implemented for many core types that were missing them,
109+
notably `Time`, `Enumerator`, `MatchData`, `Method`, `File::Stat`, `BigDecimal`
110+
and several others. This significantly reduces minor GC collection time and major
111+
GC collection frequency.
112+
* Most core classes are now using Variable Width Allocation, notably `Hash`, `Time`,
113+
`Thread::Backtrace`, `Thread::Backtrace::Location`, `File::Stat`, `Method`.
114+
This makes these classes faster to allocate and free, use less memory and reduce
115+
heap fragmentation.
116+
* Support for weak references has been added to the garbage collector. [[Feature #19783]](https://bugs.ruby-lang.org/issues/19783)
117+
118+
119+
## Other notable changes since 3.2
120+
121+
### IRB
122+
123+
IRB has received several enhancements, including but not limited to:
124+
125+
- Advanced `irb:rdbg` integration that provides an equivalent debugging experience to `pry-byebug` ([doc](https://github.com/ruby/irb#debugging-with-irb)).
126+
- Pager support for `ls`, `show_source` and `show_cmds` commands.
127+
- More accurate and helpful information provided by the `ls` and `show_source` commands.
128+
- Experimental autocompletion using type analysis ([doc](https://github.com/ruby/irb#type-based-completion)).
129+
- It is now possible to change the font color and font style in the completion dialog by a newly introduced class Reline::Face ([doc](https://github.com/ruby/ruby/blob/master/doc/reline/face.md))
130+
131+
In addition, IRB has also undergone extensive refactoring and received dozens of bug fixes to facilitate easier future enhancements.
132+
133+
## Compatibility issues
134+
135+
Note: Excluding feature bug fixes.
136+
137+
* `it` calls without arguments in a block with no ordinary parameters are
138+
deprecated. `it` will be a reference to the first block parameter in Ruby 3.4.
139+
[[Feature #18980]](https://bugs.ruby-lang.org/issues/18980)
140+
141+
### Removed environment variables
142+
143+
The following deprecated methods are removed.
144+
145+
* Environment variable `RUBY_GC_HEAP_INIT_SLOTS` has been deprecated and is a no-op. Please use environment variables `RUBY_GC_HEAP_{0,1,2,3,4}_INIT_SLOTS` instead. [[Feature #19785]](https://bugs.ruby-lang.org/issues/19785)
146+
147+
## Stdlib compatibility issues
148+
149+
### `ext/readline` is retired
150+
151+
* We have `reline` that is pure Ruby implementation compatible with `ext/readline` API. We rely on `reline` in the future. If you need to use `ext/readline`, you can install `ext/readline` via rubygems.org with `gem install readline-ext`.
152+
* We no longer need to install libraries like `libreadline` or `libedit`.
153+
154+
## Standard library updates
155+
156+
RubyGems and Bundler warn if users do `require` the following gems without adding them to Gemfile or gemspec. This is because they will become the bundled gems in the future version of Ruby.
157+
158+
This warning is suppressed if you use bootsnap gem. We recoomend to run your application with `DISABLE_BOOTSNAP=1` environmental variable at least once. This is limitation of this version.
159+
160+
Targeted libraries are:
161+
* abbrev
162+
* base64
163+
* bigdecimal
164+
* csv
165+
* drb
166+
* getoptlong
167+
* mutex_m
168+
* nkf
169+
* observer
170+
* racc
171+
* resolv-replace
172+
* rinda
173+
* syslog
174+
175+
The following default gem is added.
176+
177+
* prism 0.19.0
178+
179+
The following default gems are updated.
180+
181+
* RubyGems 3.5.3
182+
* abbrev 0.1.2
183+
* base64 0.2.0
184+
* benchmark 0.3.0
185+
* bigdecimal 3.1.5
186+
* bundler 2.5.3
187+
* cgi 0.4.1
188+
* csv 3.2.8
189+
* date 3.3.4
190+
* delegate 0.3.1
191+
* drb 2.2.0
192+
* english 0.8.0
193+
* erb 4.0.3
194+
* error_highlight 0.6.0
195+
* etc 1.4.3
196+
* fcntl 1.1.0
197+
* fiddle 1.1.2
198+
* fileutils 1.7.2
199+
* find 0.2.0
200+
* getoptlong 0.2.1
201+
* io-console 0.7.1
202+
* io-nonblock 0.3.0
203+
* io-wait 0.3.1
204+
* ipaddr 1.2.6
205+
* irb 1.11.0
206+
* json 2.7.1
207+
* logger 1.6.0
208+
* mutex_m 0.2.0
209+
* net-http 0.4.0
210+
* net-protocol 0.2.2
211+
* nkf 0.1.3
212+
* observer 0.1.2
213+
* open-uri 0.4.1
214+
* open3 0.2.1
215+
* openssl 3.2.0
216+
* optparse 0.4.0
217+
* ostruct 0.6.0
218+
* pathname 0.3.0
219+
* pp 0.5.0
220+
* prettyprint 0.2.0
221+
* pstore 0.1.3
222+
* psych 5.1.2
223+
* rdoc 6.6.2
224+
* readline 0.0.4
225+
* reline 0.4.1
226+
* resolv 0.3.0
227+
* rinda 0.2.0
228+
* securerandom 0.3.1
229+
* set 1.1.0
230+
* shellwords 0.2.0
231+
* singleton 0.2.0
232+
* stringio 3.1.0
233+
* strscan 3.0.7
234+
* syntax_suggest 2.0.0
235+
* syslog 0.1.2
236+
* tempfile 0.2.1
237+
* time 0.3.0
238+
* timeout 0.4.1
239+
* tmpdir 0.2.0
240+
* tsort 0.2.0
241+
* un 0.3.0
242+
* uri 0.13.0
243+
* weakref 0.1.3
244+
* win32ole 1.8.10
245+
* yaml 0.3.0
246+
* zlib 3.1.0
247+
248+
The following bundled gem is promoted from default gems.
249+
250+
* racc 1.7.3
251+
252+
The following bundled gems are updated.
253+
254+
* minitest 5.20.0
255+
* rake 13.1.0
256+
* test-unit 3.6.1
257+
* rexml 3.2.6
258+
* rss 0.3.0
259+
* net-ftp 0.3.3
260+
* net-imap 0.4.9
261+
* net-smtp 0.4.0
262+
* rbs 3.4.0
263+
* typeprof 0.21.9
264+
* debug 1.9.1
265+
266+
See GitHub releases like [Logger](https://github.com/ruby/logger/releases) or
267+
changelog for details of the default gems or bundled gems.
268+
269+
See [NEWS](https://github.com/ruby/ruby/blob/{{ release.tag }}/NEWS.md)
270+
or [commit logs](https://github.com/ruby/ruby/compare/v3_2_0...{{ release.tag }})
271+
for more details.
272+
273+
With those changes, [{{ release.stats.files_changed }} files changed, {{ release.stats.insertions }} insertions(+), {{ release.stats.deletions }} deletions(-)](https://github.com/ruby/ruby/compare/v3_2_0...{{ release.tag }}#file_bucket)
274+
since Ruby 3.2.0!
275+
276+
Merry Christmas, Happy Holidays, and enjoy programming with Ruby 3.3!
277+
278+
## Download
279+
280+
* <{{ release.url.gz }}>
281+
282+
SIZE: {{ release.size.gz }}
283+
SHA1: {{ release.sha1.gz }}
284+
SHA256: {{ release.sha256.gz }}
285+
SHA512: {{ release.sha512.gz }}
286+
287+
* <{{ release.url.xz }}>
288+
289+
SIZE: {{ release.size.xz }}
290+
SHA1: {{ release.sha1.xz }}
291+
SHA256: {{ release.sha256.xz }}
292+
SHA512: {{ release.sha512.xz }}
293+
294+
* <{{ release.url.zip }}>
295+
296+
SIZE: {{ release.size.zip }}
297+
SHA1: {{ release.sha1.zip }}
298+
SHA256: {{ release.sha256.zip }}
299+
SHA512: {{ release.sha512.zip }}
300+
301+
## What is Ruby
302+
303+
Ruby was first developed by Matz (Yukihiro Matsumoto) in 1993,
304+
and is now developed as Open Source. It runs on multiple platforms
305+
and is used all over the world especially for web development.

0 commit comments

Comments
 (0)