RubyKaigi is happening at Sendai, Japan from 31st May to 2nd June. It is perhaps the only conference where one can find almost all the core Ruby team members in attendance.

This is Prathamesh. I bring you live details about what is happening at the Kaigi over the next two days. If you are at the conference please come and say “Hi” to me.

Check out what happened on day 1 .

Faster Apps, No Memory Thrash: Get Your Memory Config Right by Noah Gibbs

Noah gave an awesome talk on techniques to manage the memory used by Ruby applications. One of the main point while dealing with GC is to make it run less, which means don’t create too many objects. He also mentioned that if application permits then destructive operations such as gsub! or concat should be used since they save CPU cycles and memory. Ruby allows setting up environment variables for managing the heap memory but it is really hard to choose values for these environment variables blindly.

Noah has built a tool which uses GC.stat results from applications to estimate the values of the memory related environment variables. Check out the EnvMem gem.

In the end, he discussed some advanced debugging methods like checking fragmentation percentage. The formula is prepared by Nate Berkopec.

s = GC.stat
used_ratio = s[:heap_live_slots].to_f / (s[:heap_eden_pages] * 408)
fragmentation = 1 - used_ratio

We can also use GC::Profiler to profile the code in real time to see how GC is behaving.

Benchmark used for this talk can be found here. Slides for this talk can be found here.

Guild prototype

Next I attended talk by Koichi Sasada on Guild prototype. He discussed the proposed design spec for Guild with a demo of Fibbonacci number program with 40 core CPU and 40 guilds. One of the interesting observations is that performance drops as number of guilds increases because of the global locking.

Guild performance

He discussed the concept of sharable and non-sharable objects. Sharable objects can be shared across multiple Guilds whereas non-sharable objects can only be used one Guild. This also means, you can’t make thread unsafe program with Guilds “by design”. He discussed about the challanges in specifying the sharable objects for Guilds.

Overall, there is stil a lot of work left to be done for Guilds to become a part of Ruby. It includes defining protocols for sharable and non-sharable objects, making sure GC runs properly in case of Guilds, synchronization between different Guilds.

The slides for this talk can be found here.

Ruby programming with type checking

Soutaro from SideCI gave a talk on Steep, a gradual type checker for Ruby.

In the past, Matz has said that he doesn’t like type definitions to be present in the Ruby code. Steep requires type definitions to be present in separate files with extension .rbi. The Ruby source code needs little amount of annotations. Steep also has a scaffold generator to generate the basic type definitions for existing code.

Steep v/s Sorbet

As of now, Steep runs slower than Sorbet which was discussed yesterday by Stripe team. Soutaro also discssued issues in type definitions due to meta programming in libraries such as Active Record. That looks like a challange for Steep as of now.

Web console

After the tea break, I attended talk by Genadi on how web console works.

He discussed the implementation of web-console in detail with references to Ruby internals related to bindings. He compared the web-console interface with IRB and pry and explained the difference. As of now, web console has to monkey patch some of the Rails internals. Genadi has added support for registering interceptors which will prevent this monkey patching in Rails 6. He is also mentoring a Google summer of code student to work on Actionable errors project where the user can take actions like running pending migrations via the webpage itself when the error is shown.

Ruby committers v/s the World

Ruby Committers v/s the World

RubyKaigi offers this unique event where all the Ruby committers come on stage and face the questions from the audience. This year the format was slightly different and it was run in the style of the Ruby core developer meeting. The agenda was predecided with some questions from the people and some tickets to discuss. The session started with discussion of featurs coming up in Ruby 2.6.

After that, the questions and the tickets in the agenda were discussed. It was good to see how the Ruby team takes decisions about features and suggestions.

Aprt from this, there were talks on SciRuby, mRuby, linting, gem upgrades, c extensions and more which I could not attend.

That’s all for the day two. Looking forward to the day three already!

Oh and here is the world map of all the attendees from RubyKaigi.

World map of all attendees