Created
January 18, 2019 12:52
-
-
Save omerfarukdemir/b3fb1625c959c53c73bfbaa11ccd8d25 to your computer and use it in GitHub Desktop.
This file contains 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" | |
iteration = 10000000 | |
Benchmark.bm do |bm| | |
bm.report("method") do | |
class RPC0 | |
def new_address | |
"0" | |
end | |
end | |
iteration.times do | |
RPC0.new.new_address | |
end | |
end | |
bm.report("method_missing") do | |
class RPC1 | |
def method_missing(_method, *_args) | |
"0" | |
end | |
def respond_to_missing?(method_name, include_private = false) | |
super | |
end | |
end | |
iteration.times do | |
RPC1.new.new_address | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment