diff --git a/_data/branches.yml b/_data/branches.yml index a9e159e09e..a663830e8d 100644 --- a/_data/branches.yml +++ b/_data/branches.yml @@ -9,8 +9,8 @@ # eol_date: date of EOL (YYYY-MM-DD) - name: 2.6 - status: preview - date: + status: normal maintenance + status: 2018-12-25 eol_date: - name: 2.5 diff --git a/_data/downloads.yml b/_data/downloads.yml index 8e9fab33a5..9392a60cf2 100644 --- a/_data/downloads.yml +++ b/_data/downloads.yml @@ -4,10 +4,10 @@ # optional preview: - - 2.6.0-rc2 stable: + - 2.6.0 - 2.5.3 - 2.4.5 diff --git a/_data/releases.yml b/_data/releases.yml index aae8211b78..d3d175a5e3 100644 --- a/_data/releases.yml +++ b/_data/releases.yml @@ -21,6 +21,20 @@ # 2.6 series +- version: 2.6.0 + date: 2018-12-25 + post: /en/news/2018/12/25/ruby-2-6-0-released/ + url: + gz: https://cache.ruby-lang.org/pub/ruby/2.6/ruby-2.6.0.tar.gz + zip: https://cache.ruby-lang.org/pub/ruby/2.6/ruby-2.6.0.zip + bz2: https://cache.ruby-lang.org/pub/ruby/2.6/ruby-2.6.0.tar.bz2 + xz: https://cache.ruby-lang.org/pub/ruby/2.6/ruby-2.6.0.tar.xz + sha256: + gz: f3c35b924a11c88ff111f0956ded3cdc12c90c04b72b266ac61076d3697fc072 + zip: 8a4fb6ca58202495c9682cb88effd804398bd0ef023e3e36f001ca88d8b5855a + bz2: c89ca663ad9a6238f4b1ec4d04c7dff630560c6e6eca6d30857c4d394f01a599 + xz: acb00f04374899ba8ee74bbbcb9b35c5c6b1fd229f1876554ee76f0f1710ff5f + - version: 2.6.0-rc2 date: 2018-12-15 post: /en/news/2018/12/15/ruby-2-6-0-rc2-released/ diff --git a/en/news/_posts/2018-12-25-ruby-2-6-0-released.md b/en/news/_posts/2018-12-25-ruby-2-6-0-released.md new file mode 100644 index 0000000000..88db46c920 --- /dev/null +++ b/en/news/_posts/2018-12-25-ruby-2-6-0-released.md @@ -0,0 +1,143 @@ +--- +layout: news_post +title: "Ruby 2.6.0 Released" +author: "naruse" +translator: +date: 2018-12-25 00:00:00 +0000 +lang: en +--- + +We are pleased to announce the release of Ruby 2.6.0. + +It introduces a number of new features and performance improvements, most notably: + + * A new JIT compiler. + * The `RubyVM::AbstractSyntaxTree` module. + +## JIT [Experimental] + +Ruby 2.6 introduces an initial implementation of a JIT (Just-In-Time) compiler. + +The JIT compiler aims to improve the performance of Ruby programs. Unlike traditional JIT compilers which operate in-process, Ruby's JIT compiler writes out C code to disk and spawns a common C compiler to generate native code. For more details about it, see the [MJIT organization by Vladimir Makarov](https://bugs.ruby-lang.org/projects/ruby/wiki/MJIT#MJIT-organization). + +In order to enable the JIT compiler, specify `--jit` on the command line or in the `$RUBYOPT` environment variable. Specifying `--jit-verbose=1` will cause the JIT compiler to print additional information. Read the output of `ruby --help` or [the documentation](https://bugs.ruby-lang.org/projects/ruby/wiki/MJIT#Basic-usage) for other options. + +The JIT compiler is supported when Ruby is built by GCC, Clang, or Microsoft VC++, which needs to be available at runtime. + +As of Ruby 2.6.0, we have achieved [1.7x faster performance](https://gist.github.com/k0kubun/d7f54d96f8e501bbbc78b927640f4208) compared to Ruby 2.5 on a CPU-intensive, non-trivial benchmark called [Optcarrot](https://github.com/mame/optcarrot). However, it is still experimental and many other memory-intensive workloads like Rails might not benefit from it at the moment. For more details, see [Ruby 2.6 JIT - Progress and Future](https://medium.com/@k0kubun/ruby-2-6-jit-progress-and-future-84e0a830ecbf). + +Stay tuned for the new age of Ruby's performance. + +## `RubyVM::AbstractSyntaxTree` [Experimental] + +Ruby 2.6 introduces the `RubyVM::AbstractSyntaxTree` module. **Future compatibility of this module is not guaranteed**. + +This module has a `parse` method, which parses the given string as Ruby code and returns the AST (Abstract Syntax Tree) nodes of the code. The `parse_file` method opens and parses the given file as Ruby code and returns AST nodes. + +The `RubyVM::AbstractSyntaxTree::Node` class is also introduced. You can get source location and children nodes from `Node` objects. This feature is experimental. + +## Other Notable New Features + +* Add an alias of `Kernel#yield_self` named `#then`. [[Feature #14594]](https://bugs.ruby-lang.org/issues/14594) + +* Constant names may start with a non-ASCII capital letter. [[Feature #13770]](https://bugs.ruby-lang.org/issues/13770) + +* Introduce endless ranges. [[Feature #12912]](https://bugs.ruby-lang.org/issues/12912) + + An endless range, `(1..)`, works as if it has no end. Here are some typical use cases: + + ary[1..] # identical to ary[1..-1] without magical -1 + (1..).each {|index| ... } # enumerates values starting from index 1 + ary.zip(1..) {|elem, index| ... } # ary.each.with_index(1) { ... } + +* Add `Enumerable#chain` and `Enumerator#+` [[Feature #15144]](https://bugs.ruby-lang.org/issues/15144) + +* Add function composition operators `<<` and `>>` to `Proc` and `Method`. [[Feature #6284]](https://bugs.ruby-lang.org/issues/6284) + + f = proc{|x| x + 2} + g = proc{|x| x * 3} + (f << g).call(3) # -> 11; identical to f(g(3)) + (f >> g).call(3) # -> 15; identical to g(f(3)) + +* Add `Binding#source_location`. [[Feature #14230]](https://bugs.ruby-lang.org/issues/14230) + + This method returns the source location of the binding, a 2-element array of `__FILE__` and `__LINE__`. Technically speaking, this is identical to `eval("[__FILE__, __LINE__]", binding)`. However, we are planning to change this behavior so that `Kernel#eval` ignores binding's source location [[Bug #4352]](https://bugs.ruby-lang.org/issues/4352). As such, it is recommended to use `Binding#source_location` instead of `Kernel#eval`. + +* Add an `exception:` option to `Kernel#system` which causes it to raise an exception on failure instead of returning `false`. [[Feature #14386]](https://bugs.ruby-lang.org/issues/14386) + +* Add a oneshot mode to `Coverage` [[Feature#15022]](https://bugs.ruby-lang.org/issues/15022) + + * This mode checks "whether each line was executed at least once or not", instead of "how many times each line was executed". A hook for each line is fired only once, and once it is fired the hook flag will be removed, i.e., it runs with zero overhead. + * Add `oneshot_lines:` keyword argument to Coverage.start. + * Add `stop:` and `clear:` keyword arguments to Coverage.result. If `clear` is true, it clears the counters to zero. If `stop` is true, it disables coverage measurement. + * Coverage.line_stub is a simple helper function that creates the "stub" of line coverage from a given source code. + +* Add `FileUtils#cp_lr`. It works just like cp_r but links instead of copies. [[Feature #4189]](https://bugs.ruby-lang.org/issues/4189) + +## Performance improvements + +* Speed up `Proc#call` by removing the temporary allocation for `$SAFE`. + [[Feature #14318]](https://bugs.ruby-lang.org/issues/14318) + + We have observed a 1.4x peformance improvement in the `lc_fizzbuzz` benchmark that calls `Proc#call` numerous times. [[Bug #10212]](https://bugs.ruby-lang.org/issues/10212) + +* Speed up `block.call` when `block` is passed in as a block parameter. [[Feature #14330]](https://bugs.ruby-lang.org/issues/14330) + + Combined with improvements around block handling introduced in Ruby 2.5, block evaluation now performs 2.6x faster in a micro-benchmark in Ruby 2.6. [[Feature #14045]](https://bugs.ruby-lang.org/issues/14045) + +* Transient Heap (`theap`) is introduced. [[Bug #14858]](https://bugs.ruby-lang.org/issues/14858) [[Feature #14989]](https://bugs.ruby-lang.org/issues/14989) + + `theap` is managed heap for short-living memory objects which are pointed by specific classes (`Array`, `Hash`, `Object`, and `Struct`). Making small and short-living Hash object is 2x faster. With rdoc benchmark, we observed 6-7% performance improvement. + +* Native implementations (`arm32`, `arm64`, `ppc64le`, `win32`, `win64`, `x86`, `amd64`) of coroutines to improve context switching performance of Fiber significantly. [[Feature #14739]](https://bugs.ruby-lang.org/issues/14739) + + `Fiber.yield` and `Fiber#resume` is about 5x faster on 64-bit Linux. Fiber intensive programs can expect up to 5% improvement overall. + +## Other notable changes since 2.5 + +* `$SAFE` is now a process global state and it can be set back to `0`. [[Feature #14250]](https://bugs.ruby-lang.org/issues/14250) + +* Passing `safe_level` to `ERB.new` is deprecated. `trim_mode` and `eoutvar` arguments have been changed to keyword arguments. [[Feature #14256]](https://bugs.ruby-lang.org/issues/14256) + +* Unicode support is updated to version 11. We have plans to add support Unicode version 12 and 12.1 in a future TEENY release of Ruby 2.6. This will include support for the [new Japenese era](http://blog.unicode.org/2018/09/new-japanese-era.html). + +* Merge RubyGems 3.0.1. The `--ri` and `--rdoc` options have been removed. Please use `--document` and `--no-document` options instead. + +* [Bundler](https://github.com/bundler/bundler) is now installed as a default gem. + +* In exception handling blocks, `else` without `rescue` now causes a syntax error. [EXPERIMENTAL][[Feature #14606]](https://bugs.ruby-lang.org/issues/14606) + +See [NEWS](https://github.com/ruby/ruby/blob/v2_6_0/NEWS) or [commit logs](https://github.com/ruby/ruby/compare/v2_5_0...v2_6_0) for more details. + +With those changes, [6437 files changed, 231471 insertions(+), 98498 deletions(-)](https://github.com/ruby/ruby/compare/v2_5_0...v2_6_0) since Ruby 2.5.0! + +Merry Christmas, Happy Holidays, and enjoy programming with Ruby 2.6! + +## Download + +* + + SIZE: 16687800 bytes + SHA1: c95f4e86e21390270dad3ebb94491fd42ee2ce69 + SHA256: f3c35b924a11c88ff111f0956ded3cdc12c90c04b72b266ac61076d3697fc072 + SHA512: 01f886b0c0782a06315c4a46414e9f2b66ee634ba4349c8e0697f511793ae3c56d2ad3cad6563f2b0fdced +f0ff3eba51b9afab907e7e1ac243475772f8688382 +* + + SIZE: 20582054 bytes + SHA1: a804e63d18da12107e1d101918a3d8f4c5462a27 + SHA256: 8a4fb6ca58202495c9682cb88effd804398bd0ef023e3e36f001ca88d8b5855a + SHA512: 16d66ec4a2c6a2e928d5b50e094a5efa481ac6e4d5ed77459d351ef19fe692aa59b68307e3e25229eec5f3 +0ae2f9adae2663bafe9c9d44bfb45d3833d77839d4 +* + + SIZE: 14585856 bytes + SHA1: b8638eb806efbf7b6af87b24ccc6ad915f262318 + SHA256: c89ca663ad9a6238f4b1ec4d04c7dff630560c6e6eca6d30857c4d394f01a599 + SHA512: ca3daf9acf11d3db2900af21b66231bd1f025427a9d2212b35f6137ca03f77f57171ddfdb99022c8c8bcd730ff92a7a4af54e8a2a770a67d8e16c5807aa391f1 +* + + SIZE: 11918536 bytes + SHA1: 9ddaeba3505d2855460c8c653159fc0ac8928c0f + SHA256: acb00f04374899ba8ee74bbbcb9b35c5c6b1fd229f1876554ee76f0f1710ff5f + SHA512: c56eaf85ef7b79deb34ee4590b143c07f4fc83eb79775290761aee5a7c63374659613538a41f25706ed6e19e49d5c67a1014c24d17f29948294c7abd0b0fcea8 diff --git a/ja/news/_posts/2018-12-25-ruby-2-6-0-released.md b/ja/news/_posts/2018-12-25-ruby-2-6-0-released.md new file mode 100644 index 0000000000..d0356555a1 --- /dev/null +++ b/ja/news/_posts/2018-12-25-ruby-2-6-0-released.md @@ -0,0 +1,137 @@ +--- +layout: news_post +title: "Ruby 2.6.0 Released" +author: "naruse" +translator: +date: 2018-12-25 00:00:00 +0000 +lang: ja +--- + +Ruby 2.6シリーズの最初の安定版である、Ruby 2.6.0がリリースされました。 + +Ruby 2.6.0には、多くの新しい機能やパフォーマンスの改善が含まれています。 その一部を以下に紹介します。 + +## JIT [Experimental] + +Ruby 2.6ではJIT (Just-in-time) コンパイラが導入されました。 + +JITコンパイラはあらゆるRubyプログラムの実行を高速化することを目的としています。 +他言語の一般的なJITコンパイラと異なり、RubyのJITコンパイラはC言語のソースコードをファイルとしてディスクに書き、通常のCコンパイラを用いてネイティブコードに変換することでJITコンパイルを行うという手法を用いています。(参考: [MJIT organization by Vladimir Makarov](https://bugs.ruby-lang.org/projects/ruby/wiki/MJIT#MJIT-organization)) + +JITコンパイルを有効にするには `--jit` オプションをコマンドラインまたは$RUBYOPT環境変数を指定します。`--jit-verbose=1`を指定すれば指定すれば実行中のJITコンパイルの基本的な情報を表示します。その他のオプションについては `ruby --help` か[ドキュメント](https://bugs.ruby-lang.org/projects/ruby/wiki/MJIT#Basic-usage)をご参照ください。 + +現在のJITコンパイラを利用するためには、GCC、Clang、あるいはMicrosoft VC++によってビルドされたRubyでありかつ、そのコンパイラが実行時に利用可能である必要があります。 + +Ruby 2.6.0の時点で、[Optcarrot](https://github.com/mame/optcarrot)というCPU負荷中心のベンチマークにおいてRuby 2.5の[約1.7倍の性能向上](https://gist.github.com/k0kubun/d7f54d96f8e501bbbc78b927640f4208)を達成しました。一方、Railsアプリケーションなどのメモリ負荷の高い環境における性能は現在改善中で、まだ性能向上が期待できる状態には達しておりません。詳細は[Ruby 2.6 JIT - Progress and Future](https://medium.com/@k0kubun/ruby-2-6-jit-progress-and-future-84e0a830ecbf)をご覧ください。 + +引き続き新時代のRubyの実効性能にご期待ください。 + +## `RubyVM::AbstractSyntaxTree` [Experimental] + +Ruby 2.6では抽象構文木を扱う `RubyVM::AbstractSyntaxTree` モジュールが導入されました。 + +このモジュールには、文字列をパースしてAST(抽象構文木)のNodeを返す`parse`メソッド、ファイルをパースする`parse_file`メソッドが実装されています。 +`RubyVM::AbstractSyntaxTree::Node` も導入されました。このクラスのインスタンスから位置情報や子ノードを取得することができます。この機能はexperimentalです。また、ASTの構造に関する互換性は保証されていません。 + +## 主要な新機能 + +* `Kernel#yield_self` の別名として `then` が追加されました [[Feature #14594]](https://bugs.ruby-lang.org/issues/14594) + +* ASCII以外の大文字でも定数を定義出来るようになりました [[Feature #13770]](https://bugs.ruby-lang.org/issues/13770) + +* 終端なしRange [[Feature #12912]](https://bugs.ruby-lang.org/issues/12912) + + 終わりがないRange `(1..)` が書けるようになりました。始点から無限大までのような範囲を直観的に表現できるようになります。以下に典型的な用途を示します。 + + ary[1..] # マジックナンバー -1 なしで ary[1..-1] と同じ意味 + (1..).each {|index| ... } # index が 1 から始まる無限ループ + ary.zip(1..) {|elem, index| ... } # ary.each.with_index(1) { ... } + +* `Enumerable#chain` と `Enumerator#+` が追加されました [[Feature #15144]](https://bugs.ruby-lang.org/issues/15144) + +* Procを関数合成するオペレータ `Proc#<<` 、`Proc#>>` が追加されました [[Feature #6284]](https://bugs.ruby-lang.org/issues/6284) + + f = proc{|x| x + 2} + g = proc{|x| x * 3} + (f << g).call(3) # -> 11; identical to f(g(3)) + (f >> g).call(3) # -> 15; identical to g(f(3)) + +* `Binding#source_location` の追加 [[Feature #14230]](https://bugs.ruby-lang.org/issues/14230) + + * `binding`のソースコード上の位置を `__FILE__` と `__LINE__` の二要素配列として返します。従来でも `eval("[__FILE__, __LINE__]", binding)` とすることでこれらの情報は得られましたが、将来的に `Kernel#eval` はbindingのソースコード行を無視する変更を予定しているため [[Bug #4352]](https://bugs.ruby-lang.org/issues/4352)、この新しいメソッドを用いることが今後は推奨されます。 + +* `Kernel#system` の失敗時に、falseを返す代わりに例外を上げさせる `exception:` オプションを追加 [[Feature #14386]](https://bugs.ruby-lang.org/issues/14386) + +* Coverage の oneshot_lines モードの追加 [[Feature#15022]](https://bugs.ruby-lang.org/issues/15022) + + * コードカバレッジの測定で、「各ソースコード行を何回実行したか」ではなく、「各ソースコード行を1回でも実行したか否か」を記録するモード `oneshot_lines` が導入されました。各行に設定されたフックは高々1回しか実行されません。1回実行されたフックは除去されるので、その後はオーバーヘッド無しで実行されます。 + * `Coverage.start` に `oneshot_lines:` キーワード引数を追加しました。 + * `Coverage.result` に `stop:` と `clear:` キーワードを追加しました。`clear` が真のとき、カウンタが0クリアされます。`stop`が真のとき、カバレッジ測定を終了します。 + * `Coverage.line_stub` を追加しました。これは、指定されたソースコードの行カバレッジの「スタブ」を生成する簡単な補助関数です。 + +* `FileUtils#cp_lr` が追加されました。ディレクトリ構造を再帰的に再現し、各ファイルは元のファイルへのハードリンクとするコピーです(cp -lrと同様の効果)。[[Feature #4189]](https://bugs.ruby-lang.org/issues/4189) + +## パフォーマンスの改善 + +* 後述の`$SAFE`の変更に伴って考慮すべきことが減ったため、`Proc#call`が高速化されました [[Feature #14318]](https://bugs.ruby-lang.org/issues/14318) + `Proc#call` を大量に呼び出す `lc_fizzbuzz` ベンチマークにおいては、1.4倍高速化されています [[Bug #10212]](https://bugs.ruby-lang.org/issues/10212)。 + +* `block` がブロックパラメータである時、`block.call`が高速化されました [[Feature #14330]](https://bugs.ruby-lang.org/issues/14330) + Ruby 2.5ではブロック渡しの性能が改善されましたが [[Feature #14045]](https://bugs.ruby-lang.org/issues/14045)、加えてRuby 2.6では渡されたブロックの呼び出しも改善されました。マイクロベンチマークは2.6倍の高速化が確認されています。 + +* Transient Heap (`theap`) が導入されました。[[Bug #14858]](https://bugs.ruby-lang.org/issues/14858) [[Feature #14989]](https://bugs.ruby-lang.org/issues/14989) + + theap は、特定のクラスが利用する短寿命メモリを管理します。現状、`Array`、`Object`(ユーザー定義オブジェクト)、`Struct`および8要素以下の小さな`Hash`オブジェクトが theap に対応しています。小さな短寿命`Hash`オブジェクトの生成は2倍程度高速になりました。`rdoc` ベンチマークでは、6~7%の性能改善が計測されています。 + +* コルーチンをネイティブ実装することによって、Fiberのコンテキスト切り替えの性能が大幅に向上しました(`arm32`、`arm64`、`ppc64le`、`win32`、`win64`、`x86`、`amd64`)。[[Feature #14739]](https://bugs.ruby-lang.org/issues/14739) + + `Fiber.yield`と`Fiber#resume`は64ビットLinuxでは約5倍高速です。`Fiber`を多用するプログラムでは、全体で最大5%の改善が見込まれます。 + +## その他の注目すべき 2.5 からの変更点 + +* `$SAFE` はプロセスグローバルで扱われることになると共に、`0`以外を設定した後に`0`に戻せるようになりました [[Feature #14250]](https://bugs.ruby-lang.org/issues/14250) + +* `ERB.new`に`safe_level`を渡すのは非推奨になりました。また、`trim_mode`と`eoutvar`はキーワード引数に変更されました。 [[Feature #14256]](https://bugs.ruby-lang.org/issues/14256) + +* サポートする Unicode のバージョンを 11 に更新しました。[新元号用合字対応](http://blog.unicode.org/2018/09/new-japanese-era.html)のため、Ruby 2.6 では今後の TEENY リリースで、12 そして 12.1 への更新が予定されています。 + +* RubyGems 3.0.1 をマージしました。 `--ri` と `--rdoc` オプションは使えなくなりました。`--document` または `--no-document` を利用してください。 + +* [Bundler](https://github.com/bundler/bundler) を Default gems として標準添付しました。 + +* `rescue` 無しの `else` が文法エラーとなるようになりました [EXPERIMENTAL][[Feature #14606]](https://bugs.ruby-lang.org/issues/14606) + +その他詳細については、[NEWS](https://github.com/ruby/ruby/blob/v2_6_0/NEWS) ファイルまたは[コミットログ](https://github.com/ruby/ruby/compare/v2_5_0...v2_6_0)を参照してください。 + +なお、こうした変更により、Ruby 2.5.0 以降では [6437 個のファイルに変更が加えられ、231471 行の追加と 98498 行の削除が行われました](https://github.com/ruby/ruby/compare/v2_5_0...v2_6_0) ! + +メリークリスマス。Ruby 2.6 とともに良いお年を! + +## Download + +* + + SIZE: 16687800 bytes + SHA1: c95f4e86e21390270dad3ebb94491fd42ee2ce69 + SHA256: f3c35b924a11c88ff111f0956ded3cdc12c90c04b72b266ac61076d3697fc072 + SHA512: 01f886b0c0782a06315c4a46414e9f2b66ee634ba4349c8e0697f511793ae3c56d2ad3cad6563f2b0fdced +f0ff3eba51b9afab907e7e1ac243475772f8688382 +* + + SIZE: 20582054 bytes + SHA1: a804e63d18da12107e1d101918a3d8f4c5462a27 + SHA256: 8a4fb6ca58202495c9682cb88effd804398bd0ef023e3e36f001ca88d8b5855a + SHA512: 16d66ec4a2c6a2e928d5b50e094a5efa481ac6e4d5ed77459d351ef19fe692aa59b68307e3e25229eec5f3 +0ae2f9adae2663bafe9c9d44bfb45d3833d77839d4 +* + + SIZE: 14585856 bytes + SHA1: b8638eb806efbf7b6af87b24ccc6ad915f262318 + SHA256: c89ca663ad9a6238f4b1ec4d04c7dff630560c6e6eca6d30857c4d394f01a599 + SHA512: ca3daf9acf11d3db2900af21b66231bd1f025427a9d2212b35f6137ca03f77f57171ddfdb99022c8c8bcd730ff92a7a4af54e8a2a770a67d8e16c5807aa391f1 +* + + SIZE: 11918536 bytes + SHA1: 9ddaeba3505d2855460c8c653159fc0ac8928c0f + SHA256: acb00f04374899ba8ee74bbbcb9b35c5c6b1fd229f1876554ee76f0f1710ff5f + SHA512: c56eaf85ef7b79deb34ee4590b143c07f4fc83eb79775290761aee5a7c63374659613538a41f25706ed6e19e49d5c67a1014c24d17f29948294c7abd0b0fcea8