{"id":570277,"date":"2026-05-07T02:10:13","date_gmt":"2026-05-07T02:10:13","guid":{"rendered":"https:\/\/www.newsbeep.com\/uk\/570277\/"},"modified":"2026-05-07T02:10:13","modified_gmt":"2026-05-07T02:10:13","slug":"ruby-inventor-matz-working-on-native-compiler-with-ai-help","status":"publish","type":"post","link":"https:\/\/www.newsbeep.com\/uk\/570277\/","title":{"rendered":"Ruby inventor Matz working on native compiler with AI help"},"content":{"rendered":"<p class=\"kicker \" style=\"\">DevOps<\/p>\n<p class=\"subtitle \" style=\"\">Matz gets together with Anthropic&#8217;s Claude to create an experimental ahead-of-time compiler for Ruby \u2013 though with many limitations<\/p>\n<p>Yukihiro Matsumoto &#8211; better known as Matz &#8211; is building Spinel, a native compiler for Ruby, with help from Anthropic&#8217;s Claude Code.<\/p>\n<p>Spinel, which is <a href=\"https:\/\/github.com\/matz\/spinel\" aria-label=\"Spinel project on GitHub\" target=\"_blank\" rel=\"nofollow noopener\">on GitHub<\/a>\u00a0under the MIT license, works by parsing Ruby code into AST (abstract syntax tree)<br \/>\nfiles, then converting it to C code for compilation by a standard C<br \/>\ncompiler. In Matz\u2019s tests, Spinel-compiled code runs approximately 11.6<br \/>\ntimes faster than MiniRuby &#8211;\u00a0a stripped-down Ruby build &#8211; using the in-development Roby 4.1.0.\u00a0<\/p>\n<p>The output is C code, compilable to a native executable via gcc (GNU Compiler Collection) on Linux or Windows (with MinGW &#8211; Minimalist GNU for Windows), or via LLVM&#8217;s Clang on Linux or macOS. BSD will &#8220;probably work&#8221;, according to the readme, but is not tested.<\/p>\n<p>Ruby is an interpreted language, meaning it depends on<br \/>\na runtime engine to parse and run the code. In order to improve performance,<br \/>\nRuby can use just-in-time (JIT) compilers including MJIT (method-based JIT), YJIT<br \/>\nand ZJIT, with the latter two developed by Shopify, a prominent Ruby user.<br \/>\nSpinel is different in that it generates standalone native code executables,<br \/>\nwhich can be deployed without any additional runtime.<\/p>\n<p>The downside of Spinel is that it supports only a subset of<br \/>\nRuby. Unsupported features include eval statements, which evaluate and execute<br \/>\nRuby code at runtime, threads, text encoding other than UTF-8, metaprogramming<br \/>\nsuch as defining a method at runtime, and deeply nested lambda functions.<\/p>\n<p>Ruby variables are not typed, though objects are strongly<br \/>\ntyped. Spinel performs type inference to enable C code generation, since C is a<br \/>\nstrongly typed language. The code makes use of an existing and mature Ruby<br \/>\nparser called Prism. There are many optimizations, such as method inlining and<br \/>\ndead code elimination, and the generated C compiles cleanly at the default<br \/>\nwarning level. Spinel includes a garbage<br \/>\ncollector, to reclaim memory automatically, and supports FFI (foreign function<br \/>\ninterface) for integrating with native code libraries such as libc or SQLite.<\/p>\n<p>Spinel is experimental and will not work with most existing<br \/>\nRuby code, including the web application framework Ruby on Rails. But it is<br \/>\npossible for Ruby developers to write code with Spinel in mind, such as<br \/>\nfor helper functions that can then be called from other Ruby code, as a means<br \/>\nof optimization.<\/p>\n<p>Matz presented Spinel at RubyKaigi 2026, a conference in<br \/>\nHakodate, Japan last month. According to attendees such as <a href=\"https:\/\/zenn.dev\/geeknees\/articles\/edc3cb36ea251c?locale=en\" aria-label=\"Attendee post on Spinel presentation at Ruby conference\" target=\"_blank\" rel=\"nofollow noopener\">this one<\/a>\u00a0(original text in Japanese) Matz said the idea for Spinel was conceived three years<br \/>\nago, but has now been implemented in a few weeks using AI.\u00a0<\/p>\n<p>Most of the code in<br \/>\nthe Spinel repository is headed with a comment including &#8220;co-authored by:<br \/>\nClaude Open 4.7 (1M context).&#8221;\u00a0<\/p>\n<p>Further, the project has already been rebuilt three<br \/>\ntimes over, in a series of experiments.<\/p>\n<p>Matz, perhaps, is an ideal user of AI-generated code. He<br \/>\nunderstands the code, and can benefit from the increased speed of development<br \/>\nwithout losing grip on what the code does, and is able to refine it with his existing<br \/>\nskills as well as with further AI prompting, and the code is covered by hundreds<br \/>\nof tests and benchmarks. \u00ae<\/p>\n","protected":false},"excerpt":{"rendered":"DevOps Matz gets together with Anthropic&#8217;s Claude to create an experimental ahead-of-time compiler for Ruby \u2013 though with&hellip;\n","protected":false},"author":2,"featured_media":570278,"comment_status":"","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[20],"tags":[554,733,4308,86,56,54,55],"class_list":["post-570277","post","type-post","status-publish","format-standard","has-post-thumbnail","category-artificial-intelligence","tag-ai","tag-artificial-intelligence","tag-artificialintelligence","tag-technology","tag-uk","tag-united-kingdom","tag-unitedkingdom"],"_links":{"self":[{"href":"https:\/\/www.newsbeep.com\/uk\/wp-json\/wp\/v2\/posts\/570277","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.newsbeep.com\/uk\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.newsbeep.com\/uk\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.newsbeep.com\/uk\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.newsbeep.com\/uk\/wp-json\/wp\/v2\/comments?post=570277"}],"version-history":[{"count":0,"href":"https:\/\/www.newsbeep.com\/uk\/wp-json\/wp\/v2\/posts\/570277\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.newsbeep.com\/uk\/wp-json\/wp\/v2\/media\/570278"}],"wp:attachment":[{"href":"https:\/\/www.newsbeep.com\/uk\/wp-json\/wp\/v2\/media?parent=570277"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.newsbeep.com\/uk\/wp-json\/wp\/v2\/categories?post=570277"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.newsbeep.com\/uk\/wp-json\/wp\/v2\/tags?post=570277"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}