Skip to content

Improves 2.6.0-preview1 post (en, ja) #1750

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

Merged
merged 2 commits into from
Feb 24, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 16 additions & 15 deletions en/news/_posts/2018-02-24-ruby-2-6-0-preview1-released.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,50 +18,51 @@ Ruby 2.6 introduces an initial implementation of JIT (Just-in-time) compiler.

JIT compiler aims to improve performance of any Ruby program execution.
Unlike ordinary JIT compilers for other languages, Ruby's JIT compiler does JIT compilation in a unique way, which prints C code to a disk and spawns common C compiler process to generate native code.
See also: https://github.com/vnmakarov/ruby/tree/rtl_mjit_branch#mjit-organization
See also: [MJIT organization by Vladimir Makarov](https://github.com/vnmakarov/ruby/tree/rtl_mjit_branch#mjit-organization).

How to use: Just specify "--jit" in command line or $RUBYOPT environment variable.
Specifying "--jit-verbose=1" allows to print basic information of ongoing JIT compilation. See "ruby --help" for other options.
How to use: Just specify `--jit` in command line or `$RUBYOPT` environment variable. Specifying `--jit-verbose=1` allows to print basic information of ongoing JIT compilation. See `ruby --help` for other options.

The main purpose of this JIT release is to provide a chance to check if it works for your platform and to find out security risks before the 2.6 release.
Currently JIT compiler is supported only when Ruby is built by gcc or clang and the compiler is available on runtime. Otherwise you can't use it for now.

As of 2.6.0-preview1, we're just preparing infrastructure for JIT and very few optimizations are implemented.
You can measure some of potential improvements in micro benchmarks with this release, but it is NOT ready for benchmarking final performance of Ruby's JIT compiler, especially for larger programs like Rails applications.
As of 2.6.0-preview1, we're just preparing infrastructure for JIT and very few optimizations are implemented. You can measure some of potential improvements in micro benchmarks with this release, but it is NOT ready for benchmarking final performance of Ruby's JIT compiler, especially for large programs like Rails applications.

We're going to implement method inlining in JIT compiler, which is expected to increase Ruby's performance significantly.

We're going to implement method iniling in JIT compiler, which is expected to increase Ruby's performance in order of magnitude.
Also, we're planning to increase the supported platforms, and the next plan is to support Visual Studio.

Stay tuned for the new age of Ruby's performance.

## New Features

* Add Random.bytes. [Feature #4938]
* Add `Random.bytes`. [Feature #4938]
* Add `Binding#source_location`. [Feature #14230]

* Add Binding#source_location. [Feature #14230]
* This method returns the source location of binding, a 2-element array of `__FILE__` and `__LINE__`. Traditionally, the same information could be retrieved by `eval("[__FILE__, __LINE__]", binding)`, but we are planning to change this behavior so that `Kernel#eval` ignores binding's source location [Bug #4352]. So, users should use this newly-introduced method instead of `Kernel#eval`.
This method returns the source location of binding, a 2-element array of `__FILE__` and `__LINE__`. Traditionally, the same information could be retrieved by `eval("[__FILE__, __LINE__]", binding)`, but we are planning to change this behavior so that `Kernel#eval` ignores `binding`'s source location [Bug #4352]. So, users should use this newly-introduced method instead of `Kernel#eval`.

* Add :exception option to let Kernel.#system raise error instead of returning false. [Feature #14386]
* Add `:exception` option to let `Kernel.#system` raise error instead of returning `false`. [Feature #14386]

## Performance improvements

* Speedup `Proc#call` because we dont' need to care about `$SAFE` any more.
* Speedup `Proc#call` because we don't need to care about `$SAFE` any more.
[Feature #14318]

With `lc_fizzbuzz` benchmark which uses `Proc#call` so many times we can measure
x1.4 improvements [Bug #10212].

* Speedup `block.call` where `block` is passed block parameter. [Feature #14330]

Ruby 2.5 improves block passing performance. [Feature #14045]
Additionally, Ruby 2.6 improves the performance of passed block calling.
With micro-benchmark we can observe x2.6 improvemnt.
With micro-benchmark we can observe 2.6x improvemnt.

## Other notable changes since 2.5

* $SAFE is a process global state and we can set 0 again. [Feature #14250]
* `$SAFE` is a process global state and we can set `0` again. [Feature #14250]

* Passing safe_level to ERB.new is deprecated. trim_mode and eoutvar arguments are changed to keyword arguments. [Feature #14256]
* Passing `safe_level` to `ERB.new` is deprecated. `trim_mode` and `eoutvar` arguments are changed to keyword arguments. [Feature #14256]

* Merge RubyGems 2.7.6
* Merged RubyGems 2.7.6

See [NEWS](https://github.com/ruby/ruby/blob/v2_6_0_preview1/NEWS)
or [commit logs](https://github.com/ruby/ruby/compare/v2_5_0...v2_6_0_preview1)
Expand Down
23 changes: 14 additions & 9 deletions ja/news/_posts/2018-02-24-ruby-2-6-0-preview1-released.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ Ruby 2.6.0-preview1は、重要な新機能であるJITを含むため、例年
Ruby 2.6ではJIT (Just-in-time) コンパイラが導入されました。

JITコンパイラはあらゆるRubyプログラムの実行を高速化することを目的としています。
他言語の一般的なJITコンパイラと異なり、RubyのJITコンパイラはC言語のソースコードをファイルとしてディスクに書き、通常のCコンパイラを用いてネイティブコードに変換することでJITコンパイルを行うという手法を用いています。(参考: https://github.com/vnmakarov/ruby/tree/rtl_mjit_branch#mjit-organization)
他言語の一般的なJITコンパイラと異なり、RubyのJITコンパイラはC言語のソースコードをファイルとしてディスクに書き、通常のCコンパイラを用いてネイティブコードに変換することでJITコンパイルを行うという手法を用いています。(参考: [Vladimir MakarovのMJIT organization](https://github.com/vnmakarov/ruby/tree/rtl_mjit_branch#mjit-organization))

JITコンパイルを有効にするには `--jit` オプションをコマンドラインまたは$RUBYOPT環境変数を指定します。`--jit-verbose=1`を指定すれば実行中のJITコンパイルの基本的な情報を表示します。その他のオプションについては `ruby --help` を参照ください。
JITコンパイルを有効にするには `--jit` オプションをコマンドラインまたは`$RUBYOPT`環境変数を指定します。`--jit-verbose=1`を指定すれば実行中のJITコンパイルの基本的な情報を表示します。その他のオプションについては `ruby --help` を参照ください。

今回のリリースはこのJITコンパイル機能を皆さんの環境で動作を確認して頂くとともに、セキュリティ上の問題が無いかを早期に確認するために行っています。
現在のJITコンパイラはいくつか制限があり、まずgccまたはclangによってビルドされたRubyでかつ、そのコンパイラが実行時に利用可能である必要があります。また、現在はJITコンパイルの基盤を準備している段階で、少数の最適化のみ実装しています。そのため現在でもいくつかのマイクロベンチマークでは潜在的な速度改善が見られるものの、より大きなプログラム、特にRailsアプリケーションなどではJITコンパイラの性能を計測出来る段階ではありません。
Expand All @@ -30,22 +30,27 @@ JITコンパイルを有効にするには `--jit` オプションをコマン

## 新機能

* Random.bytes の追加 [Feature #4938]
* Binding#source_location の追加 [Feature #14230]
* `binding`のソースコード上の位置を `__FILE__` と `__LINE__` の二要素配列として返します。従来でも `eval("[__FILE__, __LINE__]", binding)` とすることでこれらの情報は得られましたが、将来的に `Kernel#eval` はbindingのソースコード行を無視する変更を予定しているため [Bug #4352]、この新しいメソッドを用いることが今後は推奨されます。
* Kernel#system の失敗時に、falseを返す代わりに例外を上げさせる :exception オプションを追加 [Feature #14386]
* `Random.bytes` の追加 [Feature #4938]
* `Binding#source_location` の追加 [Feature #14230]

`binding`のソースコード上の位置を `__FILE__` と `__LINE__` の二要素配列として返します。従来でも `eval("[__FILE__, __LINE__]", binding)` とすることでこれらの情報は得られましたが、将来的に `Kernel#eval` は`binding`のソースコード行を無視する変更を予定しているため [Bug #4352]、この新しいメソッドを用いることが今後は推奨されます。

* `Kernel#system` の失敗時に、`false`を返す代わりに例外を上げさせる `:exception` オプションを追加 [Feature #14386]

## パフォーマンスの改善

* 後述の$SAFEの変更に伴って考慮すべきことが減ったため、`Proc#call`が高速化されました [Feature #14318]
* 後述の`$SAFE`の変更に伴って考慮すべきことが減ったため、`Proc#call`が高速化されました [Feature #14318]

`Proc#call` を大量に呼び出す `lc_fizzbuzz` ベンチマークにおいては、1.4倍高速化されています [Bug #10212].

* `block` がブロックパレメータである時、`block.call`が高速化されました [Feature #14330]

Ruby 2.5ではブロック渡しの性能が改善されましたが [Feature #14045]、加えてRuby 2.6では渡されたブロックの呼び出しも改善されました。
マイクロベンチマークにおいては2.6倍高速化されています。

## その他の注目すべき 2.5 からの変更点

* $SAFE はプロセスグローバルで扱われることになると共に、0以外を設定した後に0に戻せるようになりました [Feature #14250]
* `$SAFE` はプロセスグローバルで扱われることになると共に、`0`以外を設定した後に`0`に戻せるようになりました [Feature #14250]
* `ERB.new`に`safe_level`を渡すのは非推奨になりました。また、`trim_mode`と`eoutvar`はキーワード引数に変更されました。 [Feature #14256]
* RubyGems 2.7.6 をマージしました

Expand All @@ -56,7 +61,7 @@ JITコンパイルを有効にするには `--jit` オプションをコマン
今日、2月24日はRubyの25年目の誕生日です。
誕生日おめでとう! みなさんもRuby 2.6.0-preview1で楽しいプログラミングを!

## Download
## ダウンロード

* <https://cache.ruby-lang.org/pub/ruby/2.6/ruby-2.6.0-preview1.tar.gz>

Expand Down