[MacRuby] #1333: #method_missing based metaprogramming is crazy slow compared to CRuby

MacRuby ruby-noreply at macosforge.org
Sat Jun 18 14:49:03 PDT 2011


#1333: #method_missing based metaprogramming is crazy slow compared to CRuby
------------------------------------+---------------------------------------
 Reporter:  mrada@…                 |       Owner:  lsansonetti@…        
     Type:  defect                  |      Status:  new                  
 Priority:  blocker                 |   Milestone:                       
Component:  MacRuby                 |    Keywords:                       
------------------------------------+---------------------------------------
 Benchmarks are showing about 30-40x slower for me:

 {{{
 require 'rubygems'
 gem 'minitest', '>= 2.2'
 require 'minitest/autorun'
 require 'minitest/benchmark'

 class BenchMethodMissing < MiniTest::Unit::TestCase

   def self.bench_range
     bench_exp 10_000, 1_000_000
   end

   def method_missing method, *args
     self
   end

   def bench_method_missing
     assert_performance_linear do |n|
       n.times do self.lol end
     end
   end

 end
 }}}

 Results on MacRuby:
 {{{
 BenchMethodMissing      10000   100000  1000000
 bench_method_missing     0.146018        1.524551       20.248081

 Finished benchmarks in 22.144926s, 0.0452 tests/s, 0.0452 assertions/s.
 }}}

 Results on CRuby:
 {{{
 BenchMethodMissing      10000   100000  1000000
 bench_method_missing     0.002976        0.035175        0.468302

 Finished benchmarks in 0.529412s, 1.8889 tests/s, 1.8889 assertions/s.
 }}}

-- 
Ticket URL: <http://www.macruby.org/trac/ticket/1333>
MacRuby <http://macruby.org/>



More information about the macruby-tickets mailing list