在 Hacker News Daily 上看到「RJIT #7448」這個,Ruby 上一套新的 JIT 實做。
這次的 RJIT 取代掉先前的 MJIT:
This PR replaces the current implementation of MJIT with a new JIT called "RJIT"
有些特點,其中一個是 RJIT 在 buildtime 與 runtime 都不需要 compiler,這是因為 RJIT 直接用 Ruby 實做:
RJIT uses a pure-Ruby assembler to generate native code
- MJIT requires a C compiler at runtime. YJIT requires a Rust compiler at build time. RJIT doesn't require them.
- This means that RJIT's warmup could be slower than YJIT, but it's still much faster than MJIT's.
另外值得注意的是,RJIT 的作者 k0kubun 跟 YJIT 的作者 Maxime Chevalier-Boisvert 都是 Shopify 的員工,可以看出 Shopify 對於 Ruby 效能的痛?決定直接自己養人改善效能。
回到 RJIT 這邊跑的測試,可以看到他是用 YJIT 的測試套件測,這也就不會太奇怪了。
跟這次取代掉的 MJIT 相比,RJIT 在 Headline 這包測試都 OK,在 Other 這包則是有來有回,而在 Micro 這包則是有不少項目輸掉 (相比於前兩者):



這樣整體看起來算是有進步,下一版 Ruby 更新應該就會有了。