Ruby Ruby 3.0.0 Released

putaozhenhaochi · December 25, 2020 · Last by ppp8863 replied at May 12, 2021 · 9332 hits

🎉🎉🎉

喜大普奔

Concurrency / Parallel

It’s multi-core age today. Concurrency is very important. With Ractor, along with Async Fiber, Ruby will be a real concurrent language. — Matz

Reply to huacnlee

3.0 的并发支持多核了么?谁知道哪里有参考资料,发来看看

🎉🎉🎉

👏👏👏

Reply to huacnlee

文档中提及在 4 核心并行 处理的时候,性能是单核处理的 3.87 倍

def tarai(x, y, z) =
  x <= y ? y : tarai(tarai(x-1, y, z),
                     tarai(y-1, z, x),
                     tarai(z-1, x, y))
require 'benchmark'
Benchmark.bm do |x|
  # sequential version
  x.report('seq'){ 4.times{ tarai(14, 7, 0) } }

  # parallel version
  x.report('par'){
    4.times.map do
      Ractor.new { tarai(14, 7, 0) }
    end.each(&:take)
  }
end

Benchmark result:
          user     system      total        real
seq  64.560736   0.001101  64.561837 ( 64.562194)
par  66.422010   0.015999  66.438009 ( 16.685797)

The result was measured on Ubuntu 20.04, 
Intel(R) Core(TM) i7-6700 (4 cores, 8 hardware threads). 
It shows that the parallel version is 3.87 times faster than the sequential version.
Reply to huacnlee

然后又看了 ractor 的文档

https://github.com/ruby/ruby/blob/master/doc/ractor.md

从标红的地方来看,在同一个 ractor 内的线程因为有 Ractor-wide global lock 类似 GIL 锁 不能实现多核并发,但多个 ractor之前是可以实现多核并发

rails 6.1 在 ruby3 下跑没问题吧

🎉 🎉 🎉 恭喜达成新的里程碑

恭喜恭喜😀

每年的圣诞礼物来了🎉 🎉 🎉

大哥大嫂过年好!

期待已久。🎉🎉🎉

充实的圣诞 🎉 🎉

Reply to huacnlee

你这一如既往的神速啊

不知道为何 ruby 要把很多有用的库从标准库中移走真实反潮流。开箱即用的功能越来越少了。这点很不好。

Reply to lilijreey

@lilijreey

有很多吗?? 🙄

https://www.ruby-lang.org/en/news/2020/12/25/ruby-3-0-0-released/

The following libraries are no longer bundled gems or standard libraries. Install the corresponding gems to use these features.
sdbm
webrick
net-telnet
xmlrpc

为什么我在 Linux 里使用 rvm list known,没有 3.0.0 版本的,但是在 Mac 里有?

SortedSet 也没了

38 Floor has deleted
Reply to 992699452

更新一下 rvm

Reply to zhongsheng

看起来,rvm 还是有人在使用,目前很多教程都以 rbenv 为主,我都很担心,rvm 作者会撑不下去。

👏 👏 👏

为啥 3.0.0 后没有动作了。。。

macOS Big Sur 默认的版本才 ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.x86_64-darwin20] 什么时候可以默认安装到 3.0.0

3.0.1 出来了 同志们去更新呀

You need to Sign in before reply, if you don't have an account, please Sign up first.