8

Ruby 再引入另外一套 JIT 實做:RJIT

 1 year ago
source link: https://blog.gslin.org/archives/2023/03/10/11090/ruby-%e5%86%8d%e5%bc%95%e5%85%a5%e5%8f%a6%e5%a4%96%e4%b8%80%e5%a5%97-jit-%e5%af%a6%e5%81%9a%ef%bc%9arjit/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Ruby 再引入另外一套 JIT 實做:RJIT

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 的作者 k0kubunYJIT 的作者 Maxime Chevalier-Boisvert 都是 Shopify 的員工,可以看出 Shopify 對於 Ruby 效能的痛?決定直接自己養人改善效能。

回到 RJIT 這邊跑的測試,可以看到他是用 YJIT 的測試套件測,這也就不會太奇怪了。

跟這次取代掉的 MJIT 相比,RJIT 在 Headline 這包測試都 OK,在 Other 這包則是有來有回,而在 Micro 這包則是有不少項目輸掉 (相比於前兩者):

gQzOZ2t.png
SOiEiov.png
DOiH6Q1.png

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

Related

YJIT 帶給 Ruby 大量的效能提昇

在 Hacker News 首頁上看到的消息,由 Shopify 贊助的 YJIT 被 Ruby 官方接受了:「Merge YJIT: an in-process JIT compiler (github.com/ruby)」。 YJIT currently provides average speedups of 23% over the CRuby interpreter on realistic benchmarks, and near-instant warm-up time. 實做 YJIT 的 Maxime Chevalier-Boisvert 在他自己的 blog 上有提到這次的實做:「YJIT: Building a New JIT Compiler Inside CRuby」,裡面選擇的方法是他的 PhD…

October 24, 2021

In "Computer"

Ruby 3.2.0 把 YJIT 列為穩定功能了

去年有寫過 Ruby 的 YJIT 帶來的效能提昇:「YJIT 帶給 Ruby 大量的效能提昇」。 在這次的 Ruby 3.2.0 發布就把 YJIT 列為穩定功能了:「Ruby 3.2.0」。 YJIT is no longer experimental Has been tested on production workloads for over a year and proven to be quite stable. 另外就是支援的平台,看起來是多了 arm64 這邊的支援,所以馬上列表就多了一堆新機器: YJIT now supports both x86-64 and arm64/aarch64 CPUs on Linux, MacOS,…

December 26, 2022

In "Computer"

Webkit 推出 B3 JIT Compiler (Bare Bones Backend)

Webkit 推出了 B3 加快 optimization 的速度,取代原來 LLVM 的工作:「Introducing the B3 JIT Compiler」。 在文章後方 Performance Results 的部份可以看到最主要的差異在啟動時間: 另外也可以看到其他各種 performance benchmark 也幾乎都是小勝 LLVM。 接下來會有 ARM64 與其他平台的計畫: B3 is not yet complete. We still need to finish porting B3 to ARM64. B3 passes all tests, but we haven’t finished optimizing performance on ARM.…

February 16, 2016

In "Browser"

a611ee8db44c8d03a20edf0bf5a71d80?s=49&d=identicon&r=gAuthor Gea-Suan LinPosted on March 10, 2023Categories Computer, Murmuring, Programming, SoftwareTags jit, language, mjit, performance, programming, rjit, ruby, shopify, speed, yjit

Leave a Reply

Your email address will not be published. Required fields are marked *

Comment *

Name *

Email *

Website

Notify me of follow-up comments by email.

Notify me of new posts by email.

To respond on your own website, enter the URL of your response which should contain a link to this post's permalink URL. Your response will then appear (possibly after moderation) on this page. Want to update or remove your response? Update or delete your post and re-enter your post's URL again. (Learn More)

Post navigation


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK