Performance

Reduce your method calls by 99.9% by replacing Thread#pass with Queue#pop 1

Reduce your method calls by 99.9% by replacing Thread#pass with Queue#pop

When doing multi-threaded work in Ruby, there are a couple of ways to control the execution flow within a given thread. In this article, I will be looking at Thread#pass and Queue#pop and how understanding each of them can help you drastically optimize your applications. Thread#pass – what it is and how does it work …

Reduce your method calls by 99.9% by replacing Thread#pass with Queue#pop Read More »

The hidden cost of a Ruby threads leakage 12

The hidden cost of a Ruby threads leakage

Bug hunting Recently I’ve been working with one small application that would gradually become slower and slower. While there were many reasons for it to happen, I found one of them interesting. To give you a bit of context: the application was a simple single topic legacy Kafka consumer. I rewrote it to Karafka, and …

The hidden cost of a Ruby threads leakage Read More »

The hidden cost of the Ruby 2.7 dot-colon method reference usage 15

The hidden cost of the Ruby 2.7 dot-colon method reference usage

Note: This case is valid also for the “old” #method method usage. The reason why I mention that in the “dot-colon” context, is the fact that due to the syntax sugar addition, this style of coding will surely be used more intensely. Note: This feature has been reverted. See details here: bugs.ruby-lang.org/issues/16275. Note: Benchmarks and …

The hidden cost of the Ruby 2.7 dot-colon method reference usage Read More »