Benoit Daloze

Benoit Daloze

@eregon.me

Expert in dynamic language runtimes and JIT compilation, TruffleRuby lead, Rubyist. https://eregon.me

506 followers179 following343 posts

I had a great time at #EuRuKo 2026 in Brno, an amazing single-track program, many new #RubyFriends, easy to get to and no jet lag, very walkable city, everything incl. food & even karaoke available at the venue. I wanted more karaoke so I organized a second one and it was a lot of fun!

So part of the reason for Spinel (AOT compiler from Ruby to C) is lower memory usage, because RAM got expensive, and of course performance #EuRuKo

For a while I searched a way to reliably GC an object on CRuby, this is hard given CRuby uses a conservative GC and might keep it alive via the native stack or some register. This seems reliable: m = ObjectSpace::WeakMap.new Thread.new { m[Object.new] = Object.new }.join GC.start p m.keys # => []

The idea is that the native stack is gone since we join the Thread (or at least it won't be scanned by the GC) and the registers will reflect the current Thread. `Fiber.new {}.resume` might work too.

Benoit Daloze reposted

This is how we made bytecode interpreters in Java competitive with state of the art assembly tuned C interpreters. They partially evaluate like Truffle interpreters at the same time! Integrated in GraalPy, GraalWasm and Crema! Soon in GraalJS! Great work by Yudi Zheng!

GraalVM@graalvm.org

Escaping the Giant Switch: a deep dive into optimizing bytecode interpreters: medium.com/graalvm/esca...

Benoit Daloze reposted

While his mountain of horrible personal conduct could fill multiple books, one fact in particular stands out: A year ago, Musk’s actions directly led to the deaths of hundreds of thousands of people. He did it knowingly. And, worse — gleefully. Read more: www.theverge.com/tech/949259/...

Benoit Daloze reposted

I realized it has been ~1.5 years since I concluded my series of post on JSON optimization. So I got curious how much faster it became since then. 2.7.2 was the last version before I took over maintainership. 2.9.0 was the version I released at the end of the blog series.

What if Ruby 4.0 features could be implemented in pure Ruby? With TruffleRuby, that’s possible: 73% of the core library is written in Ruby itself. We currently have 10 issues tagged [easy, pure Ruby] waiting for contributors: github.com/truffleruby/...

github.comRuby 4.0 support · Issue #4231 · truffleruby/trufflerubyAny help is appreciated whether it is: implementing one of the Ruby 4.0 changes in TruffleRuby, and ensuring it is tested in specs or MRI tests and otherwise add specs. If adding specs please leave...

New take about Ruby C extensions: append_cflags "-Wall" or "-Wextra" with -Werror is a bug waiting to explode as it overrides -Wno-$category flags from RbConfig by being added at the end. It's unnecessary too because for Ruby 1.9+ RbConfig::CONFIG["warnflags"] starts with "-Wall -Wextra"

Not only @github.com search is broken for PRs for 24+ hours but also just the list of PRs misses some PRs entirely. I have to resort to email to even find my own PRs now.

I have been trying mise (from @jdx.dev) and rbenv recently, the winner is clear: $ time ruby -e0 mise: 51ms rbenv: 152ms 100ms overhead is way too much (due to shims). Additionally: * rbenv breaks `which` which causes tricky problems. * mise can install precompiled Rubies (much faster)

Maybe I should do another blog like eregon.me/blog/2021/06... but the TLDR is: use mise, the other Ruby Switchers don't come close (chruby sets GEM_HOME which causes various issues). In terms of Ruby installers, ruby-build is still the best and is used by both mise and rbenv.

My talk tomorrow is at 14:50 in the #RubyKaigi Large Hall and it now includes 2 demos running at speeds you have never seen before!

Benoit Daloze reposted

C interpreters underlie many of our most widely used language implementations -- but they're slow. Wouldn't it be great if we could turn them into JIT compiling VMs? This video shows what happens when we do just that to the normal Lua VM (first) and "yklua" (Lua w/JIT, second).

Benoit Daloze reposted