Concurrency in Ruby

At Ruby Kaigi 2016, Koichi Sasada — designer of the current Ruby virtual machine and garbage collector — presented his proposal for a new concurrency model in Ruby 3.

While Ruby has a thread system to allow for concurrency, MRI doesn’t allow parallel execution of Ruby code. Koichi looked at the various challenges of running Ruby in parallel including object mutation, race conditions, and synchronization across Threads. The result was a proposal for a new concurrent and parallel mechanism called Guilds. Continue reading

Native Technology please. Not portable React bullshit!

Many people are currently assessing React Native as a platform to develop their next mobile app on. This is no trivial matter. Switching your software development platform involves a high setup cost and will profoundly impact your daily programming workflow. It is also one of the costliest decisions to reverse after anything substantial has been built. Continue reading

How do Neural Networks work?

Nine times out of ten, when you hear about deep learning breaking a new technological barrier, Convolutional Neural Networks are involved. Also called CNNs or ConvNets, these are the workhorse of the deep neural network field. They have learned to sort images into categories even better than humans in some cases. If there’s one method out there that justifies the hype, it is CNNs.

What’s especially cool about them is that they are easy to understand, at least when you break them down into their basic parts. I’ll walk you through it. Continue reading

Let’s talk about skip list

What is a skip list?

In short, skip lists are a linked-list-like structure which allows for fast search. It consists of a base list holding the elements, together with a tower of lists maintaining a linked hierarchy of subsequence, each skipping over fewer elements.

Skip list is a wonderful data structure, one of my personal favourites, but a trend in the past ten years has made them more and more uncommon as a single-threaded in-memory structure.

My take is that this is because of how hard they are to get right. The simplicity can easily fool you into being too relaxed with respect to performance, and while they are simple, it is important to pay attention to the details.

In the past five years, people have become increasingly sceptical of skip lists’ performance, due to their poor cache behaviour when compared to e.g. B-trees, but fear not, a good implementation of skip lists can easily outperform B-trees while being implementable in only a couple of hundred lines.

How? We will walk through a variety of techniques that can be used to achieve this speed-up. Continue reading

Functional programming in C++

Functional programming becomes more prominent even in C++ these days, but sometimes the resulting code can feel awkward — especially with all the iterators one has to provide for the STL algorithms. FunctionalPlus (a small header-only library) can help overcome this issue and make your code concise and readable again.

This article is targeted towards C++ programmers new to FunctionalPlus and with little experience in functional programming. It will show how the HackerRank challenge “Gemstones” can be solved elegantly with the FunctionalPlus approach. Continue reading