Skip to content

Instantly share code, notes, and snippets.

@edward
Created July 2, 2019 15:42
Show Gist options
  • Save edward/ac4bdb81d2a5559cfd55ddb4f058b2b7 to your computer and use it in GitHub Desktop.
Save edward/ac4bdb81d2a5559cfd55ddb4f058b2b7 to your computer and use it in GitHub Desktop.
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