Ruby 3.0 Revealed...

Gunjan Solanki
2 min readSep 19, 2020

Finally, the wait is over, Ruby 3.0 will be released this Christmas as confirmed by Matz, creator of Ruby in his last presentation.

Every Ruby developer might have a bunch of questions floating in the mind, whether Ruby will overcome its shortcomings, become faster, or get async nature like other native languages like Javascript, the big buzz in the world of web development.

Well, its hard to say now, but with its upcoming features will definitely raise the bars. The new version of Ruby seems to be specifically designed to make it faster, concurrent & correct.

No more Performance issues

Falcon Rack server & Fibers:

Asynchronous threads will be controlled by Fibers. Current web servers blocks i/o operations while async nature will free other processes like API call, database operation, etc.

Why Fibers over Threads?

  • Less context switching: Context switching occurs when CPU changes from the current task to another task.

Ruby Actor or Ractor :

Similar to web workers running in the background in javascript Ractor provides parallel execution. It makes the parallel programs thread-safe as ractors can not share normal objects. Ractors communication is supported by message passing.

Memory Performance :

With Garbage Compactor (GP) most objects will be transferred to the heap and automatically compacted.

Type Checking in Ruby with RBS

What is RBS?

RBS is a type signature language that describes types & definition of classes, its methods, instances variables, inheritance/mix-in relations, and modules of Ruby. RBS comes with the goal to see common patterns in Ruby programs and also allows advanced types like union, method overloading, and generics.

RBS gem makes it possible to process the definitions written in .rbs signature files.

Special Features

  • Just In-time Compiler: JIT increases the speed of the compiling program by 50% — 500% depending on the workload.
  • Numbered block parameters : [1..100].map {_1 * 3}
  • Right Assignment
  • Some standard libraries are updated as well :

RubyGems 3.2.0.rc.1, Bundler 2.2.0.rc.1, IRB 1.2.6, Reline 0.1.5

Backward Compatability

Switching between different versions of Ruby will no longer be a problem and warnings in the logs will help to fix the errors quickly.

The speculations that Ruby 3.0 is three times faster than Ruby 2.0 is flabbergasting but its yet to come and let’s see what all it offers.

sqBnyMZlKtfqcWuOaIHPXy1C8gu2

--

--