Show HN: AsyncFutures – A Ruby gem for asynchronous/concurrent code execution

  • Posted 2 hours ago by eestrada
  • 1 points
https://rubygems.org/gems/async_futures/versions/0.1.2
This gem allows you to execute code more-or-less identically across Ractors, Threads, and Fibers. This makes it much easier to test out your code's performance behavior by using an identical API across all concurrency primitives. It is built around a flexible core Future class.

This was actually the impetus for creating this Gem: the core Ruby concurrency primitives all have different APIs and subtly different behavior even for the APIs that initially look similar. For example, `join` on Ractor and Thread instances do NOT behave the same. This Gem adds Executors that expose near identical behavior across all of them and return a Future object with identical API and behavior across all of them.

I've been working on this Gem for a few months in my spare time. I just published the Gem and made the git repo public a few minutes ago. Please feel free to review the code, test out the gem, and provide your feedback.

As a footnote: this was not vibe coded. I wanted to learn through experience how to correctly write concurrent code, so using AI would have defeated the purpose. Also, I don't particularly enjoy writing/generating code via AI, so that would have made vibe coding this doubly pointless.

The Gem has 100% line and branch coverage on CRuby 4.0 and is 0BSD licensed.

Thank you.

0 comments