Re: [閒聊] MacRuby 0.5

看板Ruby作者 (godfat 真常)時間15年前 (2009/12/31 01:23), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串3/3 (看更多)
※ 引述《godfat (godfat 真常)》之銘言: : 真要說革命的話應該是 LLVM :p : Rubinius 有沒有用 LLVM, 效能差異很驚人... 就我自己憑感覺說,五倍可能有。 : 沒用 LLVM 的速度是「完全」不能接受的,有用的話就還算可以。 : LLVM 的 clang 還在快速開發中,慢慢等... : 之前也看過有人說 Ruby 1.9 快要可以在 clang 上 compile 了。 因為對 LLVM 感興趣,剛剛看了一下他怎麼 compile ruby 程式的: (只看了幾分鐘,有講錯麻煩指正,感謝 :D) 他的作法也滿單純的,就是用這隻 Ruby 程式產生一個 C++ 程式, 內嵌 C 程式(因為 Ruby 本身是 C),用這隻 C 程式啟動 Ruby VM, 然後呼叫一個外部(後面再 link)的 C function. 這邊看後面的 compile_executable. 而那個 C function 是由 LLVM compile 出來的,compile 法看後面的 compile_object 那段。就是很標準地先 compile 成 LLVM bitcode, 然後再 compile 成 assembly, 最後再 compile 成 object (machine) code. http://svn.macosforge.org/repository/ruby/MacRuby/trunk/bin/rubyc 我節錄出兩段比較重要的:https://gist.github.com/548caf0d63f647c0fbe2 分別是 compile_object 和 compile_executable 那兩段。 簡單地說就是完全是用 LLVM 做的。 不過 Rubinius 的效能還是很差咧,真不曉得為什麼? -- #!/usr/bin/env ruby [露比] /Programming (Kn|N)ight/ 看板《Ruby》 # if a dog nailed extra legs that http://www.ptt.cc/bbs/Ruby/index.html # walks like an octopus, and Welcome ~Ruby@ptt~ # talks like an octopus, then ◢█◣ http://www.ruby-lang.org/ # we are happy to treat it as http://www.ruby-doc.org/ # if it were an octopus. http://www.rubyforge.org/ -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 220.135.160.129
文章代碼(AID): #1BEuoCeR (Ruby)
討論串 (同標題文章)
本文引述了以下文章的的內容:
完整討論串 (本文為第 3 之 3 篇):
2
5
文章代碼(AID): #1BEuoCeR (Ruby)