require "benchmark" Benchmark.bm do |x| 5.times do x.report do o = Object.new 10000.times do def o.method; end end end end end user system total real 0.080000 0.000000 0.080000 ( 0.083388) 0.040000 0.010000 0.050000 ( 0.054322) 0.040000 0.000000 0.040000 ( 0.038894) 0.040000 0.000000 0.040000 ( 0.038702) 0.040000 0.000000 0.040000 ( 0.038113) user system total real 0.070000 0.000000 0.070000 ( 0.084311) 0.050000 0.000000 0.050000 ( 0.044328) 0.030000 0.000000 0.030000 ( 0.039399) 0.040000 0.010000 0.050000 ( 0.039387) 0.040000 0.000000 0.040000 ( 0.066599) require "benchmark" Benchmark.bm do |x| 5.times do x.report do o = Object.new class << o 10000.times do def method; end end end end end end user system total real 0.080000 0.000000 0.080000 ( 0.109011) 0.040000 0.010000 0.050000 ( 0.039272) 0.040000 0.000000 0.040000 ( 0.038535) 0.040000 0.000000 0.040000 ( 0.040846) 0.030000 0.010000 0.040000 ( 0.051187) user system total real 0.050000 0.000000 0.050000 ( 0.063544) 0.030000 0.000000 0.030000 ( 0.036843) 0.040000 0.000000 0.040000 ( 0.036338) 0.040000 0.000000 0.040000 ( 0.037811) 0.030000 0.000000 0.030000 ( 0.036806)