Forked from btakita/def o.method vs class << self; def method for 1 object and 10000 method declarations
Created
December 2, 2008 06:59
-
-
Save anildigital/31035 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "benchmark" | |
Benchmark.bm do |x| | |
5.times do | |
x.report do | |
10000.times do | |
o = Object.new | |
def o.method; end | |
end | |
end | |
end | |
end | |
user system total real | |
0.100000 0.000000 0.100000 ( 0.096522) | |
0.100000 0.000000 0.100000 ( 0.111413) | |
0.100000 0.000000 0.100000 ( 0.104038) | |
0.090000 0.000000 0.090000 ( 0.095231) | |
0.100000 0.000000 0.100000 ( 0.099539) | |
user system total real | |
0.130000 0.000000 0.130000 ( 0.142741) | |
0.100000 0.000000 0.100000 ( 0.100665) | |
0.100000 0.010000 0.110000 ( 0.121455) | |
0.100000 0.000000 0.100000 ( 0.102085) | |
0.090000 0.000000 0.090000 ( 0.102203) | |
require "benchmark" | |
Benchmark.bm do |x| | |
5.times do | |
x.report do | |
10000.times do | |
o = Object.new | |
class << o | |
def method; end | |
end | |
end | |
end | |
end | |
end | |
user system total real | |
0.100000 0.010000 0.110000 ( 0.150145) | |
0.100000 0.000000 0.100000 ( 0.106283) | |
0.110000 0.000000 0.110000 ( 0.115765) | |
0.110000 0.000000 0.110000 ( 0.105696) | |
0.100000 0.000000 0.100000 ( 0.112317) | |
user system total real | |
0.130000 0.000000 0.130000 ( 0.133677) | |
0.110000 0.010000 0.120000 ( 0.113726) | |
0.110000 0.000000 0.110000 ( 0.105676) | |
0.100000 0.000000 0.100000 ( 0.106207) | |
0.100000 0.000000 0.100000 ( 0.104637) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment