Skip to content
Meetup

Colombia Scala Meetup

October 05, 2023
-

Colombia Scala Meetup

Join the Colombia Scala Meetup for a free talk (presented in English) by senior Scala developer Luis Miguel Mejía Suárez! This presentation takes place on October 5, 2023 at 11:00 a.m. COL.

Lessons Learned from Implementing an Efficient Functional Mutex

Lessons Learned from Implementing an Efficient Functional Mutex

Description:

Have you ever heard the phrase “FP or Effect systems make writing concurrent code easier and less prone to bugs”? I painfully remembered that during my journey implementing a more efficient Mutex for cats-effect. Come and join me to revive the story and learn together the lessons from experience.

A `Mutex` is a fairly common concept in concurrent programming. Yet, despite that, cats-effect didn’t provide one until recently. The reason was that they are conceptually equivalent to a `Semaphore` of a single permit. And, actually, the original implementation was just that. However, that changed with the `3.5.0` release, which introduced a brand-new, roughly 20-25% more efficient implementation.

In this talk, we will cover the iterative process that we followed from the very original implementation up to the final one that was shipped. Yet, the main idea of the talk is not just to relate the story, but to share the insights that we learned from the experience. Ranging from pointing out how annoying race conditions can be, through highlighting the differences in the imperative VS functional mental models, up to the biggest cliche yet most valuable lesson from all-time science: “standing on the shoulders of giants”.

Opps... This event was in the past!