# Ruby 3.0.0-preview1 released!

**URL:** <https://www.ruby-forum.com/t/ruby-3-0-0-preview1-released/260292>\
**Category:** Ruby\
**Tags:** about\
**Created:** [September 26, 2020, 8:29pm UTC](https://www.ruby-forum.com/t/ruby-3-0-0-preview1-released/260292 "2020-09-26T20:29:46Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![SouravGoswami](https://www.ruby-forum.com/user_avatar/www.ruby-forum.com/souravgoswami/32/2543_2.png) [@SouravGoswami](https://www.ruby-forum.com/u/SouravGoswami)\
**Post date:** [September 26, 2020, 8:29pm UTC](https://www.ruby-forum.com/t/ruby-3-0-0-preview1-released/260292/1 "2020-09-26T20:29:46Z")

</div>

Ruby 3.0.0-preview1 just got released!

> **[Ruby 3.0.0 Preview 1 Released | Ruby](https://www.ruby-lang.org/en/news/2020/09/25/ruby-3-0-0-preview1-released/)**
>
> We are pleased to announce the release of Ruby 3.0.0-preview1.

I have done some benchmarks with 2.7.1 and 3.0.0-preview1.

### Benchmark

 ![ruby 2.7.1 vs. 3.0.0-preview1](https://www.ruby-forum.com/uploads/default/original/2X/4/4f505e4d1917bafaedc0d3e293cb91c3a283b567.jpeg)

* * *

Ruby Details:

### CFLAGS

- Ruby 2.7.1

```bash
-O3 -pipe -fno-plt -march=native -mtune=native -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wwrite-strings -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable

```

- Ruby 3.0.0-preview1

```bash
-O3 -pipe -fno-plt -march=native -mtune=native -ggdb3 -Wall -Wextra -Werror=deprecated-declarations -Werror=duplicated-cond -Werror=implicit-function-declaration -Werror=implicit-int -Werror=misleading-indentation -Werror=pointer-arith -Werror=write-strings -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable

```

Benchmark Code:

> **[GitHub - Souravgoswami/simple-ruby-benchmark: A small ruby benchmark library in one file with...](https://github.com/Souravgoswami/simple-ruby-benchmark)**
>
> A small ruby benchmark library in one file with standard library stuff

* * *

### System Details

##### Kernel

```auto
Linux version 5.8.8-xanmod1-1 (makepkg@archlinux) (gcc (GCC) 10.2.0, GNU ld (GNU Binutils) 2.35) #1 SMP PREEMPT Fri, 11 Sep 2020 06:25:53 +0000

```

##### CPU

```auto
Intel(R) Core(TM) i3-6006U CPU @ 2.00GHz

```

##### Memory (RAM)

```auto
     *-bank:1
          description: SODIMM DDR4 Synchronous 2400 MHz (0.4 ns)
          product: HMA851S6AFR6N-UH
          vendor: SK Hynix
          physical id: 1
          serial: 2955429E
          slot: DIMM B
          size: 4GiB
          width: 64 bits
          clock: 2400MHz (0.4ns)

```

System was idle at 0% CPU usage during benchmarks.

---

<div class="post-metadata">

**Author:** ![SouravGoswami](https://www.ruby-forum.com/user_avatar/www.ruby-forum.com/souravgoswami/32/2543_2.png) [@SouravGoswami](https://www.ruby-forum.com/u/SouravGoswami)\
**Post date:** [September 26, 2020, 9:26pm UTC](https://www.ruby-forum.com/t/ruby-3-0-0-preview1-released/260292/2 "2020-09-26T21:26:00Z")

</div>

But the Ractor.new makes Ruby 3.0 way faster. On my dual core CPU (4 core with hyperthread), Ractor makes my code 2x faster:  
This is a bad code **without ractor** , but just compare the time:

```auto
i = 0
10000000.times { |x| i += x }
a = i

i = 0
10000000.times { |x| i += x }
a += i

i = 0
10000000.times { |x| i += x }
a += i

i = 0
10000000.times { |x| i += x }
a += i

p a

```

```auto
time ~/.rvm/rubies/ruby-2.7.1/bin/ruby no-ractor.rb 
199999980000000

real	0m2.888s
user	0m2.881s
sys	0m0.006s

```

Now let’s use **Ractor** from Ruby 3.0:

```auto
ractors = 4.times.map do
	Ractor.new do
		i = 0
		10000000.times { |x| i += x }
		i
	end
end

p ractors.map(&:take).sum

```

Time with Ractor:

```auto
$ time ruby ractor.rb
199999980000000

real	0m1.549s
user	0m5.561s
sys	0m0.006s

```

Same output, just 2x faster (I assume because it’s 2 core processor).

Surely you can do other tricks to calculate the same thing:

```auto
x = 10000000 - 1
x * (x + 1) * 2 # => 199999980000000

```

But I put that in an inefficient loop just for the test.
