It just struck me that I thought wrong about what are ruby 3 goals are. So I want to summarize what Ruby 3 is about in this post for those who misunderstand it like me.
Ruby 3 has 3 main goals: Performance, Remove limits of GIL, Static type checker. And one big constraint: compatibility. Matz doesn’t want a repetition of Python 3 situation.
Sources: Ruby 3x3, Ruby 3.0 with Yukihiro “Matz” Matsumoto.
Performance
This goal also called Ruby 3x3 - it means that bottom line here is to make Ruby 3 at least 3 times faster than Ruby 2. The main bet in this race is on Just In Time compiler or JIT for short. But also there are other things that can help with speed
Generational GC- doneMake symbols collectibleFrozen string literals, to decrease pressure on GC.See 8976, 11473Ahead of time compiler or for short AOT.I guess bootsnap solves the problem- Decrease heap fragmentation and improve CoW. A lot of work in this direction done by Aaron Patterson. See gc-compact, tweet, deck, Memory Fragmentation and Bloat in Ruby
- Improve allocator. See 9113, scalloc
JIT
There are a lot of possible candidates here:
Remove limits of GIL
GIL stands for Global Interpreter Lock. Because of backward compatibility restriction, they do not want to remove GIL completely. Instead, idea is to introduce new concurrency abstraction which will overcome GIL limits. This new mechanism is called Guilds. You can read more about guilds here
Static type checker
This is the only goal of Ruby 3, which does not have proposed solution from Ruby team. The problem is that team wants backward compatibility on one side and does not want to add heavy type declarations on the other side - because ruby should be enjoyable language.
Options:
- Type Checking Ruby Programs with Annotations
- steep
- diamondback-ruby
- rdl - not sure about this. It is pretty confusing from my POW
- typed.rb