Contact us

Ruby 3x3 - Is it actually three times faster?

Nov 23, 2024

about 3 min read

services-header-img

Like most people, we have come to Ruby via Rails. For Ruby-lovers, Ruby 3x3 is an eye-catching gem. We have been using Ruby 2 since 2015, almost seven years without any updates.

Like most people, we have come to Ruby via Rails. For Ruby-lovers, Ruby 3x3 is an eye-catching gem. We have been using Ruby 2 since 2015, almost seven years without any updates. This time, Matz claimed, "Ruby3 will be three times faster than Ruby2". The excitement for this update also comes from concurrency and static analysis.


 


 

How Matz talks about his creation - Ruby3


 

In an interview with Jonan Schefler, Matz has revealed some trivia that ease the public curiosity about Ruby 3

 

The inventor' reason behind Ruby's speed

Matz said while creating Ruby, he focused on productivity and the joy of programming, thus making Ruby relatively slow. Later on, he and the team had to try many things to make Ruby faster. For example, the engine for Ruby 1.8 written by Matz was so slow. Luckily Koichi replaced the virtual machine, and it runs many times more quickly.




 

Why the name "Ruby 3x3"

Although they are an open-source language and not a business, Matz and the team tried hard to make Ruby better. Therefore he named it Ruby 3x3, which signifies a goal that it should be three times faster. He mentioned Javascript using JIT technique, which is not yet applied to Ruby 2. He aimed to leverage it and other tactics to improve the speed.


 

Features and major updates

About this significant and dazzling update, we have three main focus to discuss: performance, concurrency, and static analysis

Ruby 3 performance


 

"No language is fast enough." - Matz. 

Although the goal was to make Ruby 3 three times faster, they did not aim to make Ruby the fastest language out there. As Ruby language's performance gets boosted, applications are also faster and more scalable.


 

CPU optimization: The JIT(Just In Time) compiler was optimized from its previous versions. MJIT appeared first in Ruby 2.6. Ruby 3 MJIT today offers better security and significantly enhance web app's performance


 

Memory optimization: Fully automatic garbage compaction and object grouping allows for better memory usage.


 

Parallelism and Concurrency in Ruby 3

"I regret adding Threads." - Matz

Matz thinks Threads in Ruby is not at the right abstraction level for developers. This is improved in Ruby 3 as it is ideal for making applications with a focus on concurrency.

Fibers and Fiber scheduler: consider one of the cores of Ruby 3, Fibers replaces Threads, takes up less memory space. Code segments can be paused and then resume giving the programmer more control in I/O handling

Ractors (Guilds): VM lock (GVL) no longers hindrances parallelism with the help of a concurrent abstraction that is Actor-Model like - Ractors.


 

Static Analysis

"I hate tests because they aren't DRY." - Matz

Tests can result in code duplication, while it is very much helpful in checking the app. Therefore, static analysis is introduced. With inline type annotations that aren't dry, using .rbs file instead of .rb, static analysis is better than tests.


 

With so many new features and improvements in performance, concurrency, and static analysis, Ruby 3 is more satisfying to developers. The future of Ruby 3 is bright. This is good news in the new year 2021 for Ruby-lovers.  


 

If you want to upgrade your application to Ruby 3, contact Golden Owl - we offer up-to-date technology solutions that are cutting-edge.

 

liner

Our latest posts

latest-postWeb Development

The Best ERP for Distribution in 2024: Key Features & Tools for The Right Fit!

Dive into our in-depth guide on the best ERP solution for distribution! Whether you’re looking to systemize operations or enhance customer satisfaction, we’ve got the insights you need to make the right choice.

Nov 8, 2024

about 8 min read

latest-postMobile App Development

Augmented Reality in eCommerce: The Answer To Boost Sales & Cut Returns (2024)

Discover how augmented reality in eCommerce boosts sales, reduces returns, and enhances customer satisfaction with immersive shopping experiences in 2024.

Nov 4, 2024

about 9 min read

latest-postWeb Development

eCommerce POS Integration: Benefits, Features, and Tools for Multi-Channel Sales (2024)

Improve multi-channel sales and efficiency with eCommerce POS integration this year!

Nov 1, 2024

about 7 min read

dialog

Subscribe to Golden Owl blog

Stay up to date! Get all the latest posts delivered straight to your inbox
messenger icon