精華區beta Ruby 關於我們 聯絡資訊
出自此 內含許多超連結 http://lightyror.blogspot.com/2006/09/ruby.html 這裡有一位對岸網友提出的Ruby 跟 Python 比較 引發一陣討論 不過裡面的test case 主要是大量的字串操作比較消耗時間 Ruby 在這裡會輸主要原因是因為 Ruby 的字串是 mutable 而 Python 字串是 immutable 其他的算法方面倒是沒輸多少 不過這篇Performance比較裡面,倒是提到一件很值得注意的事情 Ruby 在 Linux 上面跑得比 Windows 來得快,記憶體也比較省 (不管是 Windows or Cygwin ,Ruby on Linux 都贏) TEST CASE 1 : 速度比較 Ruby1.8.4@Win32:0.641s Ruby1.8.5@Cygwin:0.558s Ruby-yarv@Cygwin:0.453s Ruby1.8.5@Ubuntu: 0.434s Ruby-yarv@Ubuntu: 0.373s TEST CASE 2 : Memory比較 ruby1.8.4@win32: 5.63, 97M ruby1.8.5@cygwin: 4.77s, 93M(3.84s, 95M) ruby1.8.5@ubuntu: 3.78s, 91M (3.36s, 91M) 另外一個 TEST CASE ruby1.8.4@win32: 7.3s, 5M ruby1.8.5@cygwin: 6.45s, 5M(6.04s, 5M) ruby1.8.5@ubuntu: 4.25s, 3.2M(4.11s, 3.2M) PS. Performance比較,一向是各說各話 尤其是硬體的比較(AMD 跟 Intel 效能比較更是烽火連天) 不過 Ruby 的慢一向是有口皆碑 (笑) 所以跟 Python 比速度,好像也沒啥好比的 XD 反正我們是靠其他部份去贏人的 -- lighty RoR 是一個介紹 lighttpd , SQLite , Ruby and Rails 的 Blog http://lightyror.blogspot.com/ -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 61.218.90.242 ※ 編輯: giive 來自: 61.218.90.242 (09/18 15:27) ※ 編輯: giive 來自: 61.218.90.242 (09/18 15:28)
Schelfaniel:看起來時間約是 Python 的 1.5 - 2 倍 09/18 16:08