From: ko1@... Date: 2016-07-28T11:21:22+00:00 Subject: [ruby-core:76595] [Ruby trunk Bug#10212] MRI is not for lambda calculus Issue #10212 has been updated by Koichi Sasada. Compare with the following 3 interpreters. ``` target 0: trunk (ruby 2.4.0dev (2016-07-28 trunk 55767) [x86_64-linux]) at "~/ruby/install/trunk/bin/ruby" target 1: jruby (jruby 9.1.2.0 (2.3.0) 2016-05-26 7357c8f OpenJDK 64-Bit Server VM 24.95-b01 on 1.7.0_101-b00 +jit [linux-x86_64]) at "~/tmp/jruby-9.1.2.0/bin/jruby" target 2: mruby (mruby 1.2.0 (2015-11-17) ... trunk 44.57820153050125 trunk 44.37776151672006 trunk 44.04692719876766 jruby 19.29094495996833 jruby 18.705794921144843 jruby 19.137680288404226 mruby 40.22595031186938 mruby 40.92319735698402 mruby 40.18542462773621 ----------------------------------------------------------- raw data: [["app_lc_fizzbuzz", [[44.57820153050125, 44.37776151672006, 44.04692719876766], [19.29094495996833, 18.705794921144843, 19.137680288404226], [40.22595031186938, 40.92319735698402, 40.18542462773621]]]] Elapsed time: 311.477478533 (sec) ----------------------------------------------------------- benchmark results: minimum results in each 3 measurements. Execution time (sec) name trunk jruby mruby app_lc_fizzbuzz 44.047 18.706 40.185 Speedup ratio: compare with the result of `trunk' (greater is better) name jruby mruby app_lc_fizzbuzz 2.355 1.096 ``` JRuby wins! ---------------------------------------- Bug #10212: MRI is not for lambda calculus https://bugs.ruby-lang.org/issues/10212#change-59820 * Author: Koichi Sasada * Status: Open * Priority: Normal * Assignee: Koichi Sasada * ruby -v: ruby 2.2.0dev (2014-08-21 trunk 47241) [x86_64-linux] * Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN ---------------------------------------- # title is joke. I added benchmark/bm_lc_fizzbuzz.rb which solve fizz buzz program by lambda calculus. http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=47447 (This program is closly described by ["Understanding Computation"] (http://computationbook.com/) by Tom Stuart) ([Japanese translation of this book] (http://www.oreilly.co.jp/books/9784873116976/) will be published soon) The results of this program are: ``` jruby 1.7.12 (1.9.3p392) 2014-04-15 643e292 on OpenJDK 64-Bit Server VM 1.7.0_65-b32 [linux-amd64] real 0m26.648s user 0m30.091s sys 0m4.369s mruby 89e9df26819b9555fb790a16662f4ad2b9cbb2e2 real 0m27.145s user 0m27.110s sys 0m0.012s ruby 2.2.0dev (2014-08-21 trunk 47241) [x86_64-linux] real 1m54.648s user 1m54.512s sys 0m0.028s ``` It is clear that MRI is too slow. I haven't dig details, but maybe it is because of GC perforamance. Because Proc (and Env) objects are wb-unprotected, such objects are marked on every minor GC. This problem is not critical because MRI is not for lambda calculus :p but we can improve about it. -- https://bugs.ruby-lang.org/ Unsubscribe: