|
| 1 | +--- |
| 2 | +layout: news_post |
| 3 | +title: "Ruby 2.6.0-rc2 Released" |
| 4 | +author: "naruse" |
| 5 | +translator: |
| 6 | +date: 2018-12-15 00:00:00 +0000 |
| 7 | +lang: en |
| 8 | +--- |
| 9 | + |
| 10 | +We are pleased to announce the release of Ruby 2.6.0-rc2. |
| 11 | + |
| 12 | +Ruby 2.6.0-rc2 is the second release candidate of Ruby 2.6.0. |
| 13 | +RC2 is released to test bundled Bundler 1.17 instead of 2.0. |
| 14 | +It introduces some new features and performance improvements, for example: |
| 15 | + |
| 16 | +## JIT |
| 17 | + |
| 18 | +Ruby 2.6 introduces an initial implementation of JIT (Just-in-time) compiler. |
| 19 | + |
| 20 | +JIT compiler aims to improve performance of any Ruby program execution. |
| 21 | +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. |
| 22 | +See also: [MJIT organization by Vladimir Makarov](https://github.com/vnmakarov/ruby/tree/rtl_mjit_branch#mjit-organization). |
| 23 | + |
| 24 | +How to use: Just specify `--jit` in command line or `$RUBYOPT` environment variable. |
| 25 | +Specifying `--jit-verbose=1` allows to print basic information of ongoing JIT compilation. See `ruby --help` for other options. |
| 26 | + |
| 27 | +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. |
| 28 | +JIT compiler is supported when Ruby is built by GCC, Clang, or Microsoft VC++, which needs to be available on runtime. Otherwise you can't use it for now. |
| 29 | + |
| 30 | +As of Ruby 2.6.0-rc2, we achieved 1.7x faster performance than Ruby 2.5 on CPU-intensive non-trivial benchmark workload called Optcarrot <https://gist.github.com/k0kubun/d7f54d96f8e501bbbc78b927640f4208>. We're going to improve the performance on memory-intensive workload like Rails application as well. |
| 31 | + |
| 32 | +Stay tuned for the new age of Ruby's performance. |
| 33 | + |
| 34 | +## RubyVM::AbstractSyntaxTree [Experimental] |
| 35 | + |
| 36 | +Ruby 2.6 introduces `RubyVM::AbstractSyntaxTree` module. |
| 37 | + |
| 38 | +This module has `parse` method which parses a given ruby code of string and returns AST (Abstract Syntax Tree) nodes, and `parse_file` method which parses a given ruby code file and returns AST nodes. |
| 39 | +`RubyVM::AbstractSyntaxTree::Node` class is also introduced. You can get location information and children nodes from `Node` objects. This feature is experimental. Compatibility of the structure of AST nodes are not guaranteed. |
| 40 | + |
| 41 | +## New Features |
| 42 | + |
| 43 | +* Add a new alias `then` to `Kernel#yield_self`. [[Feature #14594]](https://bugs.ruby-lang.org/issues/14594) |
| 44 | + |
| 45 | +* `else` without `rescue` now causes a syntax error. [EXPERIMENTAL][[Feature #14606]](https://bugs.ruby-lang.org/issues/14606) |
| 46 | + |
| 47 | +* constant names may start with a non-ASCII capital letter. [[Feature #13770]](https://bugs.ruby-lang.org/issues/13770) |
| 48 | + |
| 49 | +* endless range [[Feature #12912]](https://bugs.ruby-lang.org/issues/12912) |
| 50 | + |
| 51 | + An endless range, `(1..)`, is introduced. It works as it has no end. This shows typical use cases: |
| 52 | + |
| 53 | + ary[1..] # identical to ary[1..-1] without magical -1 |
| 54 | + (1..).each {|index| ... } # inifinite loop from index 1 |
| 55 | + ary.zip(1..) {|elem, index| ... } # ary.each.with_index(1) { ... } |
| 56 | + |
| 57 | +* Add `Binding#source_location`. [[Feature #14230]](https://bugs.ruby-lang.org/issues/14230) |
| 58 | + |
| 59 | + 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]](https://bugs.ruby-lang.org/issues/4352). So, users should use this newly-introduced method instead of `Kernel#eval`. |
| 60 | + |
| 61 | +* Add `:exception` option to let `Kernel#system` raise error instead of returning `false`. [[Feature #14386]](https://bugs.ruby-lang.org/issues/14386) |
| 62 | + |
| 63 | +* add the oneshot mode [[Feature#15022]](https://bugs.ruby-lang.org/issues/15022) |
| 64 | + * 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 at most once, and after it is fired the hook flag is removed, i.e., it runs with zero overhead. |
| 65 | + * Add `:oneshot_lines` keyword argument to Coverage.start. |
| 66 | + * 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. |
| 67 | + * Coverage.line_stub, which is a simple helper function that creates the "stub" of line coverage from a given source code. |
| 68 | + |
| 69 | +* `FileUtils#cp_lr`. [[Feature #4189]](https://bugs.ruby-lang.org/issues/4189) |
| 70 | + |
| 71 | +## Performance improvements |
| 72 | + |
| 73 | +* Speedup `Proc#call` because we don't need to care about `$SAFE` any more. |
| 74 | + [[Feature #14318]](https://bugs.ruby-lang.org/issues/14318) |
| 75 | + |
| 76 | + With `lc_fizzbuzz` benchmark which uses `Proc#call` so many times we can measure |
| 77 | + x1.4 improvements [[Bug #10212]](https://bugs.ruby-lang.org/issues/10212). |
| 78 | + |
| 79 | +* Speedup `block.call` where `block` is passed block parameter. [[Feature #14330]](https://bugs.ruby-lang.org/issues/14330) |
| 80 | + |
| 81 | + Ruby 2.5 improves block passing performance. [[Feature #14045]](https://bugs.ruby-lang.org/issues/14045) |
| 82 | + Additionally, Ruby 2.6 improves the performance of passed block calling. |
| 83 | + With micro-benchmark we can observe x2.6 improvement. |
| 84 | + |
| 85 | +* Transient Heap (theap) is introduced. [[Bug #14858]](https://bugs.ruby-lang.org/issues/14858) [[Feature #14989]](https://bugs.ruby-lang.org/issues/14989) |
| 86 | + theap is managed heap for short-living memory objects which are pointed by |
| 87 | + specific classes (Array, Hash, Object, and Struct). For example, making small |
| 88 | + and short-living Hash object is x2 faster. With rdoc benchmark, we observed |
| 89 | + 6-7% performance improvement. |
| 90 | + |
| 91 | +## Other notable changes since 2.5 |
| 92 | + |
| 93 | +* `$SAFE` is a process global state and we can set `0` again. [[Feature #14250]](https://bugs.ruby-lang.org/issues/14250) |
| 94 | + |
| 95 | +* Passing `safe_level` to `ERB.new` is deprecated. `trim_mode` and `eoutvar` arguments are changed to keyword arguments. [[Feature #14256]](https://bugs.ruby-lang.org/issues/14256) |
| 96 | + |
| 97 | +* Supported Unicode version is updated to 11. It is planed to update 12 and 12.1 in future TEENY releases of Ruby 2.6. |
| 98 | + |
| 99 | +* Merge RubyGems 3.0.0.beta3. `--ri` and `--rdoc` options was removed. Please use `--document` and `--no-document` options instead of them. |
| 100 | + |
| 101 | +* Merge [Bundler](https://github.com/bundler/bundler) as Default gems. |
| 102 | + |
| 103 | +See [NEWS](https://github.com/ruby/ruby/blob/v2_6_0_rc2/NEWS) |
| 104 | +or [commit logs](https://github.com/ruby/ruby/compare/v2_5_0...v2_6_0_rc2) |
| 105 | +for details. |
| 106 | + |
| 107 | +With those changes, |
| 108 | +[6411 files changed, 228864 insertions(+), 97600 deletions(-)](https://github.com/ruby/ruby/compare/v2_5_0...v2_6_0_rc2) |
| 109 | +since Ruby 2.5.0! |
| 110 | + |
| 111 | +Enjoy programming with Ruby 2.6.0-rc2! |
| 112 | + |
| 113 | +## Download |
| 114 | + |
| 115 | +* <https://cache.ruby-lang.org/pub/ruby/2.6/ruby-2.6.0-rc2.tar.gz> |
| 116 | + |
| 117 | + SIZE: 16723556 bytes |
| 118 | + SHA1: a4d7f8c8c3584a60fe1a57d03d80162361fe3c78 |
| 119 | + SHA256: 9c0245e96379246040f1fd0978f8e447e7f47cdccbdaffdb83302a995276b62b |
| 120 | + SHA512: 789f608f93db6e12835911f3105d9abe2fabb67cd22dc3bafdff38716ac56974925738e7f7788ebef5bdf67b6fd91f84a4ee78a3e5d072cfc8ee0972de737b08 |
| 121 | +* <https://cache.ruby-lang.org/pub/ruby/2.6/ruby-2.6.0-rc2.zip> |
| 122 | + |
| 123 | + SIZE: 20643747 bytes |
| 124 | + SHA1: c1a2898949d929dd952880f1c1c2bac2ef2609b4 |
| 125 | + SHA256: e8a446cf1f2ffc14483604de0a5e12c2578dd2f672ae87798ca2bbb9b7b73899 |
| 126 | + SHA512: 2d06feae13f485f5da59574672b14d03881ed532d652648f94e2435f5d81df623b5ef532b8ba8e0b9bc4ee6baf7c0328a5610eab753a9020a0fea2673254c76c |
| 127 | +* <https://cache.ruby-lang.org/pub/ruby/2.6/ruby-2.6.0-rc2.tar.bz2> |
| 128 | + |
| 129 | + SIZE: 14581998 bytes |
| 130 | + SHA1: 94bbee97de4955e67effb7f512c58300617a3a09 |
| 131 | + SHA256: b3d03e471e3136f43bb948013d4f4974abb63d478e8ff7ec2741b22750a3ec50 |
| 132 | + SHA512: 9bfbe83fd3699b71bae2350801d8c967eb128e79b62a9d36fc0f011b83c53cab28a280939f4cc9f0a28f9bf02dce8eea30866ca4d06480dc44289400abf580ba |
| 133 | +* <https://cache.ruby-lang.org/pub/ruby/2.6/ruby-2.6.0-rc2.tar.xz> |
| 134 | + |
| 135 | + SIZE: 11908088 bytes |
| 136 | + SHA1: 13a7f06d832dc28989e3e4321490a6ba528ed023 |
| 137 | + SHA256: d620b3d87b3190867304067f3ce77f5305f7ec1b2e73b09c17710c97c028986d |
| 138 | + SHA512: a3dc43c0bc70dfdb9ff0d18b5b9797bbf332524f5d3bbb7940cf4e32286ca715808acfd11ebf3cdbe358a2466b7c6b5be3a7a784af7eb95c071fe1f8b4ab1261 |
0 commit comments