r/ruby • u/software__writer • Apr 24 '26
Spinel -- Ruby AOT Compiler
https://github.com/matz/spinelSpinel compiles Ruby source code into standalone native executables. It performs whole-program type inference and generates optimized C code, achieving significant speedups over CRuby.
Spinel is self-hosting: the compiler backend is written in Ruby and compiles itself into a native binary.
78
Upvotes
17
u/headius JRuby guy Apr 24 '26
Glad to see this is interesting now.
https://github.com/headius/rubyflux
16
u/schneems Puma maintainer Apr 24 '26
Very surprised by many things here. The name for one. The co attributed commits with Claude. I use it at work too but sort of pretend I don’t. I’m curious where we will land here as a community in several years. Sort of reminds me of the “sent by iphone” email footers.
The end goal is great. Shipping Ruby executables is a sore spot. Bootstrapping Ruby for things like the buildpack is annoying and full of edge cases (needing an interpreter to install an interpreter).
The biggest win I see here is for tooling like bundler and other infra tools so you can write the logic in Ruby but ship to a machine that doesn't have Ruby yet. So you could rewrite chruby or RVM or rbenv or mise in Ruby (if you wanted to). Bundler shipping as a static binary could allow it to the ability to install a Ruby interpreter (like other cough spinel associated tools). The limitations to not depend on eval (etc) are reasonable for that class of tooling. Overall this is really cool.
5
u/blowmage Apr 24 '26
This is very exciting.
3
u/Suspicious-Tailor-53 May 04 '26
Ho provato spinel , con codex, ed ho creato un driver async libpq, performa meglio di pg, Active record e Sequel... Solo a tempo perso nelle pause del lavoro... Non è un orm, lo devo completare... Sono moderatame contento!
8
u/kcdragon Apr 24 '26
Wow. They took RubyGems and now they took Spinel.
2
u/gurgeous Apr 24 '26
I am super excited about this. I've been experimenting with zig but I'd prefer to write my native binaries in ruby...
2
u/Swimming_Ad1570 Apr 26 '26
This showed up on our radar a few days ago, as velocity is climbing fast! The self-hosting aspect is wild 💪 a Ruby compiler that compiles itself into a native binary. Matz is playing the long game here.
2
u/Critical-Explorer179 May 18 '26
Did you guys try Crystal? I don't see how AOT-compiled Ruby by Matz would perform differently in the end than Crystal, which is already stable (and even before that it was usable in production for many years). It would be made by Matz, of course, that's big, but otherwise?
2
u/keremimo Apr 24 '26
Just played around with it. Amazing. Crazy how in the right hands AI can be extremely capable like any other tool.
1
u/EvenRegret314 May 04 '26
This is really impressive! A self-hosted Ruby AOT compiler that compiles to optimized C sounds game-changing.
13
u/[deleted] Apr 24 '26
[removed] — view removed comment