4 def method_missing(sym, *args)
9 def method_missing(sym, *args)
18 def method_missing(sym, *args)
27 def method_missing(sym, *args)
36 def method_missing(sym, *args, &block)
48 Benchmark.bm(40) do |bm|
49 bm.report("1M method_missing") do
50 1000000.times { mm.foo }
52 bm.report("1M sends") do
53 1000000.times { mm2.send :bar }
55 bm.report("1M method_missing with send") do
56 1000000.times { mm2.foo }
58 bm.report("1M method_missing with block") do
59 1000000.times { mm3.foo }
61 bm.report("1M 1-arg method_missing") do
62 1000000.times { mm.foo 1 }
64 bm.report("1M 1-arg sends") do
65 1000000.times { mm2a.send :bar1, 1 }
67 bm.report("1M 1-arg method_missing with send") do
68 1000000.times { mm2a.foo 1 }
70 bm.report("1M 1-arg method_missing with block") do
71 1000000.times { mm3.foo 1 }
73 bm.report("1M 4-arg method_missing") do
74 1000000.times { mm.foo 1,2,3,4 }
76 bm.report("1M 4-arg sends") do
77 1000000.times { mm2b.send :bar,1,2,3,4 }
79 bm.report("1M 4-arg method_missing with send") do
80 1000000.times { mm2b.foo 1,2,3,4 }
82 bm.report("1M 4-arg method_missing with block") do
83 1000000.times { mm3.foo 1,2,3,4 }