Big News: Ruby Version 3.0

Do you love Christmas gifts? Just wait for the 2020 winter holidays!

2020 will be a big year for the whole Ruby community.

The Ruby founders have a really great present in store for us – the release of Ruby 3.0!

The gift is beautiful, but there are also lots of cool features inside.

Recently there have been some rumors of RoR’s death. And I believe this update will smash those rumors to pieces.

Updates in Ruby 3.0Updates in Ruby 3.0

3 major upgrades in version Ruby 3: performance, concurrency, static analysis, transition issues

Ruby 3.0 performance: no more issues

Everybody knows Ruby is the perfect language for MVPs, prototypes, and startups, but Ruby’s speed is definitely the biggest issue with the programming language. People claim that the language needs to be faster for massive projects. Do you agree? If so, you’ll enjoy the updated Ruby 3.0. In 2020, Ruby 3 will be three times faster than the current Ruby version thanks to Ruby’s performance optimization.

Also check out: Pros and Cons of Ruby on Rails

Memory performance

The current Ruby 2.6 version still has some Ruby on Rails performance issues, especially with memory usage.

The problems occur when programmers create new objects which are then swept away and “fragment the heap.” When this happens, a lot of space for such objects remains unused, and we use more memory than is actually needed.

Great news: in Ruby 3.0 this problem will be solved with a garbage compactor (GP).

This GP has some key features:

  1. Object separation. While some objects are pinned, the rest can be transferred to the heap.
  2. Auto-compaction. No special commands are required to compact the garbage – in the new version automatic compaction is fully supported.

CPU Performance

One of the most promising updates for Ruby CPU performance is the new Ruby JIT.

Another new feature that might significantly improve the programming language’s performance is the Medium Internal Representation JIT compiler, which is lightweight and convenient to work with.

We hope that this Ruby updates will actually be included in Ruby 3.0 since it might solve Ruby’s issues and result in significant performance improvement beyond the current JIT.

Related read: Ruby on Rails Scalability Issues

The Latest Ruby 3 Version: Concurrency Changes

There are some programming problems in Ruby, and these imperfections will be fixed in the 3×3 era.

Falcon Rack web server and Async

Falcon Rack is a composable asynchronous input/output framework for Ruby.
Together with Async, these features do not block I/O (input and output data). In contrast to current web servers, which block I/O and take up a lot of additional time, async frees your server to accept other requests while it waits on your database, memory store, or API calls.

Static type checker

If you set the necessary configurations, the type checker will validate input data.

But there is a paradox: the Ruby team wants to use backward compatibility but doesn’t want to add heavy type declarations.

Therefore, this part of the update for Ruby programming problems is a little uncertain, since the Ruby team does not have any proposed solutions yet.

Parallel computation

The current Ruby version has a global VM Lock (GVL), which makes it impossible to use parallel computing. The Ruby update promises to change this. With Ruby 3, programmers will be able to use parallel threaded computation.

That means that Ruby now is single-flow language. With Ruby 3.0, it will be possible to execute parallel tasks, which makes the whole process way faster.

Static analysis for clearer code

 Static analysis is an additional tool that helps to check the code after the tests. The good thing – your work gets an additional checkup. The bad one – static analysis relies on type annotations, which in their turn cause Ruby challenges as the repetitions in code.

There are two major solutions:

  • Steep
  • Sorbet

On June 20, Stripe team announced the Sorbet type-checker, that is still in early stages, but is mature enough to run on the majority of Ruby code. You can check it out, but be careful, as far as your experience might still be rough.

Sorbet uses inline type annotations, unlike Steep’s parallel annotation files. This way, Sorbet appears to be fast, but Steep allows you to keep type annotations in a separate file. Therefore, the code will be clearer and more laconic than it is currently.

Transition issues

Transmission parameters

Some bad news: we can face some possible Ruby coding challenges with the transmission of parameters. The update isn’t automatic – once Ruby 3.0 is out, you’ll need to update it manually. That means that in some cases the code written on the current Ruby version may be deprecated after the Ruby update.

Some good news: there is a solution. The latest version (before the Ruby upgrade) will give developers some warnings. For instance, if this or that feature is planned to be changed in Ruby 3.0, you’ll find the prompts about it right in the log. Therefore, you will see beforehand what needs to be fixed after Ruby 3 is out.

Backward compatibility

More good news: there is a plan to add backward compatibility for all the previous Ruby versions, so it won’t be too hard to switch from one version to another.

Ruby 3.0 eveolutionRuby 3.0 eveolution

Our expertise in Ruby on Rails

Cambridge Brain Sciences

[embedded content]

Cambridge Brain Sciences is a company developing engaging assessments of brain and brain function. When we met our clients, they already had their Cambridge Brain product (business-to-customer platform). At this point, the client needed to develop a new business-to-business platform called Cambridge Brain Sciences Health. Therefore, we needed to build a new platform from scratch with the required features.

Our solutions:

The Sloboda Studio team has helped the client to develop an MVP of the new business-to-business platform. 

During the development process, we released new core features, such as:

  • New Admin Account
  • Automated assessment schedules
  • New CBS Health Report
  • Email notifications
  • Custom-branded assessment ability
  • Data exporting and Importing
  • GDPR compliance
  • Payment integration with Stripe and Braintree

SAFHYRE

SAFHYRE is an online recruiting platform. This platform gives employers access to the database of employees. When we met our client, the project was at its initial stage. Therefore, we needed to create a whole platform from scratch.

Our solutions:

Sloboda Studio led a project through a full cycle of the development cycle, including back-end,  front-end, design, and tests. 

As a result of our work, we implemented such features as:

  • Candidate database architecture
  • Authentication features
  • Resume search results page
  • Homepage
  • Admin panel
  • Adding possibility to See Resume
  • Matching Algorithm Development
  • Payment feature integration
  • Messaging system

Conclusion

Ruby with its Rails framework always used to be one of the best technology choices for startups. We can see that from the experience of Airbnb, Couchsurfing, Kickstarter, or Urban Dictionary.

From the next year Ruby will probably be suitable even for corporations. Ruby 3.0 will be great for its:

  • Better concurrency
  • Static type checker
  • Static analysis
  • Tips for better transmission
  • Backward compatibility

All these updates will help to make Ruby even more scalable, faster to code and run, and just easier to use.

If you need some tips or help with your Ruby project, feel free to contact our Rails experts for a free consultation.

Posted by Contributor