From Ruby 2 to 4: Updating a C extension for a Modern VM
The Ruby VM has evolved a lot from Ruby 2 to Ruby 4. While this evolution was reflected in Ruby's C APIs, great care was taken to provide backwards compatibility. Old gems work with little change on Ruby 4, ensuring apps don't get stuck on old versions just because some dependency has not been updated.
However, C extensions shouldn't remain stuck on "old ways". If not updated, they can silently get in the way of modern VM features such as GC compaction, or force the garbage collector to do extra unnecessary work, on top of missing out on performance and correctness improvements.
In this talk, I present our ongoing work to modernize the datadog gem for a Ruby 4-era VM, identifying key modern Ruby C APIs, the VM assumptions they encode, and when and why native gems should adopt them.
-
Ivo AnjoI love to work on Ruby performance and low-level details and that's how I ended up at Datadog where I'm building the production open-source Ruby profiler inside the
datadoggem. This gem extensively uses Ruby C APIs so I get to spend a lot of time staring at them.I believe in bringing profiling (and observability in general!) to everyone: these kinds of tools should be easy to use and understandable by all Rubyists, and I'm working hard on delivering this vision ;)