Created
July 2, 2019 15:42
-
-
Save edward/ac4bdb81d2a5559cfd55ddb4f058b2b7 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 'rubygems' | |
require 'benchmark/ips' | |
class ExampleClass | |
def foo; 42; end | |
end | |
module ExampleMixin | |
def foo; 43; end | |
end | |
Benchmark.ips do |bm| | |
bm.report("without dci") do | |
ExampleClass.new.foo | |
end | |
bm.report("with dci") do | |
obj = ExampleClass.new | |
obj.extend(ExampleMixin) | |
obj.foo | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment